高等继续教育 / 面向对象程序设计
正确率:认证
题型描述: 简答题
写出下面程序的执行结果:
#include<iostream.h>
class AA{
int a;
public :
AA(int i){a=i;cout<<"AA="<<a<<"
";}
virtual ~AA( ){cout<<"~AA="<<a<<"
";}
};
class BB:public AA{
int b;
public :
BB(int i,int j):AA(i){b=j;cout<<"BB="<<b<<"
";}
~BB( ){cout<<"~BB="<<b<<"
";}
};
void main( )
{AA *pa=new AA(8); delete pa;
AA*pb=new BB(6,9); delete pb;
}
参考答案:
佳题速递: