Say I have CFooer and it implements method void foo().
I then have ISomething that has virtual void foo() = 0.
I now create a class:
class CSuperFoo : public CBase, public CFooer, public ISomething
{
};
When I instance CSuperFoo, will I get a cannot instance abstract class error, or would this use CFooer’s implementation to satisfy ISomething. If this does not work, why doesn’t it?
Thanks
You will have to provide an implementation in the Derived class
CSuperFooto be able to create objects of it, otherwise it will be an Abstract class.The method
foo()from the Base classISomethingneeds to be overridden in the deriving classCSuperFooexplicitly because compiler cannot see any relation between method from classCFooerandISomething::foo()as there is no relation betweenCFooer&ISomething, SO it demands the specific method being implemented in the derived class so that it is not an Abstract class anymore.Does’nt work on Ideone.