I understand that certain data type object have certain buffer size. E.g. a char is 1byte. So, when creating a self-defined class object,
- How much memory is allocated to
the object
a
? - Is the amount of memory allocated different if the object is created on stack, or heap?
- Is the amount of memory allocated fixed, or can be changed?
Creating a user-defined class instance:
Animal a; //stack memory
a.makeSound();
Animal *a = new Animal(); //heap memory
a->makeSound();