|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <iostream>
#include <stdlib.h>
using namespace std;
enum Color {Red, Yellow, Green, White};
class Circle
{
float radius;
public:
void Cricle(float r)
{
radius = r;
}
float Area()
{
return 3.14*radius*radius;
}
};
class Table
{
float height;
public:
Table(float h)
{
height = h;
}
float Height()
{
return height;
}
};
class RoundTable:public Table,public Circle
{
Color color;
public:
RoundTable(float h, float r, Color c);
int GetColor()
{
return color;
}
};
RoundTable::RoundTable( float h, float r, Color c):Table(h),Circle(r)
{ : no matching function for call to`Circle::Circle(float&)'
color = c;
}
int main()
{
RoundTable cir_table(15.0, 2.0, Yellow);
std::cout << "The table properties:" << endl;
std::cout << "Height = " << cir_table.Height() << endl;
std:: cout << "Area = " << cir_table.Area() << endl;
std::cout << "Color = " << cir_table.GetColor() << endl;
}
|
|