vendredi 19 août 2016

why override under private inheritance?

class Base {
public:
   virtual void f() {}
};

class Derived : private Base {
public:
   void f() override {}
};

My question is there any use to such override? private inheritance implies that you can not store Derived in Base pointer and thus it will never be needed to dynamically dispatch f to the correct type.

Aucun commentaire:

Enregistrer un commentaire