Question OOP-POLY-0038
EasyWhat is the output of this code?
#include <iostream>
using namespace std;
class A {
public:
void show() { cout << "A"; }
};
class B : public A {
public:
void show() { cout << "B"; }
};
int main() {
B b;
A* p = &b;
p->show();
}
- A.
AB
- B.
Compilation error
- C.
Sign up free to see the answer and a step-by-step explanation.