Sunday, December 07, 2003

Re: Type Casting

Yeah you're right... Pointers of type A as well as pointers of type B will point to memory location 0. It's just that with type A pointers, you will only have access to sizeof( A ) which is 0 to 3. With type B pointers, you have access to everything, 0 to 7, which is sizeof( B ).

if a new object A is created it would not have the members of B ... these r different objects u r talking of .... only when u write

A* p = new B();

only here will a pointer of A have all the data members of A & B .... i'm sure ur'll know this but i'm just clarifying anyway :)

dinesh.

No comments: