Suppose I have these abstract classes Foo and Bar:
Foo
Bar
class Foo; class Bar; class Foo { public: virtual Bar* bar() = 0; }; class Bar {
Covariance is based on inheritance diagram, so since you cannot declare
class ConcreteBar : public Bar;
hence no way to tell compiler about covariance.
But you can do it with help of templates, declare ConcretFoo::bar as template and later bounding allows you solve this problem