1#include<iostream>
2using namespace std;
3
4class A
5{
6public:
7A() { cout << "A's constructor called" << endl; }
8};
9
10class B
11{
12public:
13B() { cout << "B's constructor called" << endl; }
14};
15
16class C: public B, public A // Note the order
17{
18public:
19C() { cout << "C's constructor called" << endl; }
20};
21
22int main()
23{
24 C c;
25 return 0;
26}
1The "diamond problem" (sometimes referred to as the "Deadly Diamond of Death") is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C
2If there is a method in A that B and C have overridden, and D does not override it, then which class of the method does D inherit: that of B, or that of C?