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) - 专业知识收录平台">
当前位置:首页 > 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< <

高老师2年前 (2024-03-26)C+ + 程序设计(04737)9

写出以下程序的输出结果
#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
不超过最大面积值, 是否扩建?

扫描二维码免费使用微信小程序搜题/刷题/查看解析。

版权声明:本文由翰林刷题小程序授权发布,如需转载请注明出处。

本文链接:https://doc.20230611.cn/post/239527.html

分享给朋友: