0
What is the output of the following C++ code involving multiple inheritance?
class A { public: int x = 10; };
class B { public: int x = 20; };
class C : public A, public B { };
int main() {
C obj;
cout << obj.A::x << " " << obj.B::x;
return 0;
}
- A10 10
- B20 20
- C10 20
- DCompilation error, ambiguous
Correct answer: C