virtual~A(){cout< < ”是否扩建?"< < endl;)
};
class B:public A
{public:int width,high;
B()
{ width=40;high=20;
cout< < - C+ + 程序设计(04737) - 专业知识收录平台">
virtual~A(){cout< < ”是否扩建?"< < endl;)
};
class B:public A
{public:int width,high;
B()
{ width=40;high=20;
cout< < - C+ + 程序设计(04737) - 专业知识收录平台">
写出以下程序的输出结果
#include
using namespace std;
class A
{public:A(){cout< < "测量广场”;}
virtual~A(){cout< < ”是否扩建?"< < endl;)
};
class B:public A
{public:int width,high;
B()
{ width=40;high=20;
cout< < "初始面积为:"< < width*high< < endl;
}
~B(){if(width*high< 10000)cout< < "不超过最大面积值,";}
};
int main()
{ A*p=new B();
delete p;
return 0;
}
每答对一处划线内容得 1 分,每行划线处前后顺序正确得 1 分。
测量广场 初始面积为: 800
不超过最大面积值, 是否扩建?
扫描二维码免费使用微信小程序搜题/刷题/查看解析。
版权声明:本文由翰林刷题小程序授权发布,如需转载请注明出处。