Question OOP-POLY-0017
HardWhat is the output of this code?
#include <iostream>
using namespace std;
struct A {
A() { who(); }
virtual void who() { cout << "A"; }
};
struct B : A {
void who() override { cout << "B"; }
};
int main() {
B b;
return 0;
}
- A.
A
- B.
Error
- C.
Sign up free to see the answer and a step-by-step explanation.