题目内容
写出下面程序的运行结果。#includeusing namespace std;class A{ public:A( ){ cout<<"A::A()called.\n"; }virtual ~A( ){ cout<<"A::~A()called.\n"; }};class B:public A{ public:B(int i){ cout<<"B::B()called.\n";buffer=new char[i]; }virtual ~B( ){ delete []buffer;cout<<"B::~B()called.\n"; }private:char* buffer;};void fun(A* a){ delete a; }int main(){ A *b=new B(10);fun(b);return 0;}程序的运行结果是:__________________________________________________________
查看答案
搜索结果不匹配?点我反馈
更多问题