//11/26 作业(5) #include
using namespace std; const double PI=3.14159; class Shape { protected: int x,y; public: //void set(int x1,int y1=0){x=x1; y=y1;} //Shape(int x1,int y1=0){x=x1; y=y1;} virtual double GetArea()=0; virtual double GetPerim()=0; }; class Rectangle:public Shape { public: Rectangle(int x1,int y1=0){x=x1; y=y1;} double GetArea(){cout<<"The area of rectangle is: "<
<
set(5,8); cout<
GetArea()<
GetPerim()<
set(10); cout<
GetArea()<
GetPerim()<
//11/26 作业(5)
最新推荐文章于 2022-01-22 17:28:09 发布