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