It will affect clients using Bar* (or smart_ptr<Bar>) to point to a Foo object, even if BarV2 provides the exact same public interface as Bar, unless BarV2 publicly inherits from Bar.Originally Posted by @nthony
It will affect clients using Bar* (or smart_ptr<Bar>) to point to a Foo object, even if BarV2 provides the exact same public interface as Bar, unless BarV2 publicly inherits from Bar.Originally Posted by @nthony
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Yes, I knew what you meant.
Your approach also specifically requires that all member functions of your class are implemented inline with the class declaration.
The typedef approach I suggested does what you want (with the exception that it is necessary to use "super::draw()" rather than "super.draw()"). That is a syntactic difference, not a functional one. If you insist on Java syntax, then use Java.
With that comment, you've shown a fundamental misunderstanding of OO design.
Interface is a fundamental requirement for derivation: the intent of derivation is that the derived class implements the same interface as the base class, but can provide different implementation of the behaviour required by that interface. Yes, with derivation, it is possible to extend an interface (eg a derived class provides the base class interface, plus more) but the key premise of derivation is still that the derived class supports the base class interface.