The length of a rectangle is 4 inches longer than the width. The perimeter of the rectangl
A.5
B.7
C.10
D.12
E.14
A.5
B.7
C.10
D.12
E.14
下面程序运行时输出结果为______。
include<iostream.h>
include
class Rect
{
public:
Rect(int l, int w){length=l; width=w;)
void Print(){cout<<"Area:"<<length*width<<end1;}
void operator delete(void*p){free(p);}
private:
int length, width;
};
void main()
{
Rect *p;
p=new Rect(5, 4);
p->Print();
delete p;
}
【计算题】定义一个抽象类Shape,包括属性height,抽象方法void set(double x,double y)用于赋属性值,抽象方法double area()用于求面积,定义抽象类Shape的子类长方形Rect类(定义属性length)和三角形Triangle类(定义属性bottom),重写抽象方法set(double x,double y)和double area()求它们的面积,编写测试TestShape类测试结果。
A.rect[0.1 , 0 , 1 , 1]
B.rect[0 , 0.1 , 1 , 1]
C.rect[0 , 0 , 0.9 , 1]
D.rect[0 , 0 , 1 , 0.9]
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!