迷途喚醒 - 2007-4-26 13:40:00
哥們幫我 !!!!!
#include<iostream.h>
#include<string.h>
#define PI 3.14159
class Circle
{
private:
double radius;
double aear;
public:
void Get_R_Aear(double r,double a)
{
radius=r;
aear=a;
a=PI*r*r;
}
void Show_Aear(double r,double a)
{
cout<<"輸入r:";
cin>>r;
cout<<"面積為:"<<a<<endl;
}
};
class Table
{
private:
int height;
public:
int Get_Height(int h)
{
return height=h;
};
void Show_Height()
{
cout<<"高為:"<<height<<endl;
};
};
class Roundtable:public Circle,public Table
{
private:
char Color[5];
public:
Get_Color(char c[])
{
strcpy(Color,c);
};
void Show_Color()
{
cout<<"顔色為:"<<Color<<endl;
};
};
void main()
{
Roundtable Rt;
Rt.Get_R_Aear();
Rt.Show_Aear();
Rt.Get_Height(100);
Rt.Show_Height();
Rt.Get_Color("red");
Rt.Show_Color();
}
迷途喚醒 - 2007-4-26 13:44:00
G:\待休整程序\新建文件夹\練習.cpp(45) : warning C4183: 'Get_Color': member function definition looks like a ctor, but name does not match enclosing class
G:\待休整程序\新建文件夹\練習.cpp(55) : error C2660: 'Get_R_Aear' : function does not take 0 parameters
G:\待休整程序\新建文件夹\練習.cpp(56) : error C2660: 'Show_Aear' : function does not take 0 parameters
执行 cl.exe 时出错.
練習.exe - 1 error(s), 0 warning(s)
迷途喚醒 - 2007-4-27 15:44:00
怎麽就沒一個熱心人幫我呢??
世態炎涼 阿!!
天下奇才 - 2007-5-1 12:00:00
类中并没有定义无参数的方法,泥无参数调用一定出问题的
© 2000 - 2026 Rising Corp. Ltd.