编写图形类(基类),该类有周长、面积等属性和求周长、求面积等成员函数。编写图形类的派生类-----矩形类
展开全部
class shap
{
public:
float p;
float a;
public:
shap();
~shap();
float GetP(){};
float GetA(){};
}
class rect : public shap
{
public:
float l;
float w;
float p;
float a;
public:
rect();
~rect();
float GetP(){return 2*(l+w)};
float GetA(){return l*w};
}
{
public:
float p;
float a;
public:
shap();
~shap();
float GetP(){};
float GetA(){};
}
class rect : public shap
{
public:
float l;
float w;
float p;
float a;
public:
rect();
~rect();
float GetP(){return 2*(l+w)};
float GetA(){return l*w};
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询