Regarding Dynamic casting

In reply to dave_59:

Hi Dave,

Could you please throw a light on my reply, given above, regarding memory allocation during object creation. I just want to know that my understanding regarding memory allocation is correct or not. For your quick ref, I have quated my reply below.

  1. By creating an object of a child class, does not create a memory for a parent class. But it creates a memory for child class based on the members declared in child class as well as in parent class. When you create an object for a parent class then it will create a memory for parent class based on the members declared in a parent class.
    E.g.,
class parent;
int a;
endclass
class child extends parent;
int b;
endclass

In above example, when you will create an object of parent class, it will create a 32bit (int a) memory for parent class, but by creating an object of a child class, it will create a 64bit (int a + int b) for child class. That does not mean that the child class object creates a memory for parent class.

Thanks.
-H.Modh