Simple question: Will this hierarchy cause a DP?
//Abstract base class
class A {
//Implement pure virtual methods with a default definition.
//Pure virtual methods are still declared pure virtual.
};
//Abstract derived class
class B : public A {
//Define pure virtual methods with a default definition.
//Pure virtual methods are still declared pure virtual.
};
//Abstract base class
class C {
//Define pure virtual methods with a default definition.
//Pure virtual methods are still declared pure virtual.
};
//Concrete class
class D : public B, public C {
//Implement all methods from D, B, and C
};
No. Draw the picture; all bases are unique:
The "diamond problem" only pertains to ambiguous base classes due to multiple repeated bases, e.g. if
D
were to derive from bothA -> B
andA -> C
: