Question OOP-INH-0061
HardWhat is the output of this code?
#include <iostream>
using namespace std;
class A {
public:
A() { cout << "A"; }
virtual ~A() { cout << "~A"; }
};
class B : public A {
public:
B() { cout << "B"; }
~B() { cout << "~B"; }
};
int main() {
A *p = new B();
delete p;
}
- A.
BA
AB - B.
AB
AB - C.
Sign up free to see the answer and a step-by-step explanation.