0

Abstraction allow us to create a single class, for every objects we want to create, instead of creating classes for each individ

I mean, abstraction just helps us to implement the data-hiding feature through it. What it has to do with the instantiation of a class?

3rd Jan 2019, 6:36 AM
Devasheesh
Devasheesh - avatar
3 Answers
+ 1
Well, let me say it like this. A car has similar features to any other car, right? They have 4 wheels, use gasoline, have an engine, have doors, a drivers seat, steering wheel. You get the point. If I wanted to have a C++ Car class, I would make it abstract, with variables that I could change, like wheels. Why specifically say 4 wheels when there are cars with 8 wheels and even 16 wheels? Therefore, we use abstraction. We are vague, so that the Car class can conform to any car, not just specific cars. The instantiation of a class is simply creating an object. We can create multiple Car objects with their own specific variables.
6th Jan 2019, 8:49 AM
Rain
Rain - avatar
+ 1
If you have any other questions, you can ask me and I'll do my best to answer.
6th Jan 2019, 9:47 AM
Rain
Rain - avatar
0
Okay. I got it 😅.
6th Jan 2019, 9:46 AM
Devasheesh
Devasheesh - avatar