subclass to base class but not subclass pointer to base class pointer?

Namespace rswhite4 at googlemail.com
Sat Apr 20 11:10:35 PDT 2013


> I return a pointer from an instance of B and the compiler cast 
> it implicit to A*. Look what is inside of 'bstore' (instances 
> of B) and what the type of 'get' is (A*).
>
> And no, the equivalent version would use 'A' as return type of 
> 'get', not 'A*'.

Ah, I think I understand know what you meant.
Sure there is no pointer to pointer polymorphism in there.
But I thought, even if D classes are reference types and not 
really compareable to C++ classes, that the compiler could do the 
same implicit cast for pointer of D classes. ;)


More information about the Digitalmars-d-learn mailing list