Question OOP-INH-0015
HardWhat is the output of this code?
#include <iostream>
using namespace std;
class A { public: virtual void show() { cout << "A"; } };
class B : virtual public A { public: void show() override { cout << "B"; } };
class C : virtual public A { };
class D : public B, public C { };
int main() {
D d;
d.show();
return 0;
}
- A.
A
- B.
Error
- C.
Sign up free to see the answer and a step-by-step explanation.