主观

程序的输出结果如下:

Parent:: Parent( ) called.

Child:: Child( ) called.

Child:: ~Called( ) called.

Parent:: ~Parent( ) called.

根据输出结果在下面程序中的下划线出填写正确的语句

include ﹤iostream﹥

using namespace std;

class Parent

{

public:

Parent( ) { cout ﹤﹤"Parent:: Parent( ) called. \n"; }

vintual ~Parent( ) { cout ﹤﹤"Parent:: ~Parent( ) called. \n"; }

}:

class Child: public Parent

{

public:

Child(int i) {

cout﹤﹤"Child:: Child( ) called. \n";

buf=new char[i];

}

virtual ~Child( ) {

delete [ ]buf;

cout﹤﹤"Child:: ~Child( ) called. \n";

}

private:

char * buf;

};

void disp( _________ *a)

{

_________;

}

woid main( )

{

Parent *a=new Child(20);

disp(a);

int d;

cin ﹥﹥d;

}

参考答案
您可能感兴趣的试题
¥

订单号:

遇到问题请联系在线客服

订单号:

遇到问题请联系在线客服