.h

来自「类的继承派生中的一个很简单的用法」· C头文件 代码 · 共 63 行

H
63
字号
#include"iostream.h"
#include"string.h"
class Circle{
private:
	
	double radius;
public:
    Circle(){};
	Circle(double a)
	{     
          radius=a; 
	}
	double Area(double radius);

};


class Table{
private:

	double height;

public:
	Table(){};
	Table(double b)
	{       
            height=b;
	}
	void show(double b)
	{
	   cout<<"桌子的高度为:"<<b<<endl;
	
	}
};



class Roundtable:public Circle,public Table{

private:
  
	char color[20];

public:
   
	Roundtable(){ 	};
    
	Roundtable(double a,double b,char *c):Circle(a),Table(b)
	{  
	  	strcpy(color,c);

	}

	
void showcolor()

	{
	
	    cout<<"桌子的颜色为:"<<color<<endl;

	}
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?