C++ 面向对象 - 类的多态性与虚函数

C++ 面向对象 - 类的多态性与虚函数,第1张

第3关:计算图像面积

#include 
using namespace std;

/********* Begin *********/
class Shape
{
public:
    virtual void PrintArea()=0;//基类的声明
    
    
    
};

class Rectangle : public Shape
{
public:
	float width;
	float height;
	void PrintArea()
	{
		cout<<"矩形面积 = "<

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1323992.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-12
下一篇2022-06-12

发表评论

登录后才能评论

评论列表(0条)