No implicitly convert derived ptr to base ptr?

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Tue Apr 24 22:50:51 PDT 2012


The compiler rejects this:

    class Base {}
    class Derived : Base {}

    void main()
    {
        Base*    basePtr;
        Derived* derivedPtr;

        basePtr = derivedPtr; // ERROR
    }

Is that really correct that it shouldn't be allowed?




More information about the Digitalmars-d-learn mailing list