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

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Apr 20 08:32:09 PDT 2013


On 4/20/13, Namespace <rswhite4 at googlemail.com> wrote:
> Why can D implicitly cast from the subclass to the base class,
> but not implicitly from the subclasse pointer to the base class
> pointer?
>
> This works: http://dpaste.1azy.net/30dd34a0
> This not: http://dpaste.1azy.net/ffacfd83
>
> Makes not much sense for me.
>

I'd really recommend reading one of the D books before asking so many
fundamental questions: http://wiki.dlang.org/Books
And probably the spec too.

Bottom line: D is not C++.


More information about the Digitalmars-d-learn mailing list