My Goal: In C# I would write
interface A
{
void fA();
}
interface B
{
void fB();
}
interface AB : A, B
{
}
class SomeImplementationOfJustA : A
{
public void fA() { }
}
class ImplementationOfAB : SomeImplementationOfJustA , AB
{
public void fB() { }
}
My problem: In C++ I came up with
class A
{
public:
virtual void fA() = 0;
};
class B
{
public:
virtual void fB() = 0;
};
class AB : public A, public B
{
};
class SomeImplementationOfJustA : public A
{
public:
virtual void A::fA() override { std::cout<< "fA"; }
};
class ImplementationOfAB : public SomeImplementationOfJustA , public AB
{
public:
virtual void B::fB() override {}
};
but it does not allows me to call
AB * x = new ImplementationOfAB();
I get Error C2259 'ImplementationOfAB ': cannot instantiate abstract class
In ImplementationOfAB, is there a way to take the partial implementation of A from SomeImplementationOfJustA and just let me implement the remaining partial implementation of B?