class A1
{
public:
A1(){printf("1 ");}
~ A1(){printf("2 ");}
};
class A2:A1
{
public:
A2(){printf("3 ");}
~A2(){printf("4 ");}
};
int main(int argc, const char * argv[]) {
// insert code here...
A1 *p;
p = (A1*) new A1();
delete p;
p = (A1*)new A2();
delete p;
A2 *q;
q = (A2*) new A1();
delete q;
q = (A2*) new A2();
delete q;