In object oriented programming, there is concept of class and objects. We define a class and then create its instance (object). Consider the below C++ example:
class Car{
public:
string model;
bool petrol;
int wheels = 4;
}
int main(){
Car A;
cout << A.wheels;
return 0;
}
Now I know no memory was allocated to the class Car until the object A was created. Now I am swamped in the confusion that if no memory was allocated to the Car, then at the time of creating object A, how object A will know that wheels is equal to 4 ? I mean it should be saved somewhere in the memory.
Please ignore mistakes as it is a question from beginner's side :)