Suppose I have these abstract classes Foo and Bar:
Foo
Bar
class Foo; class Bar; class Foo { public: virtual Bar* bar() = 0; }; class Bar {
Doesn't static polymorphism solve your problem? Feeding the base class with the derived class through template argument? So the base class will know the derivative Type and declare a proper virtual?