Question OOP-INH-0042
MediumWhat is the output of this code?
#include <iostream>
using namespace std;
class A { public: int x = 1; };
class B : public A { public: int x = 2; };
int main() {
B b;
cout << b.x << b.A::x;
}
- A.
12
- B.
11
- C.
Sign up free to see the answer and a step-by-step explanation.