#include<iostream.h>
class planet
{
protected:
//**1**
double distance;int revolve;
public:
planet(double d,int r)
{
distance=d;
revolve=r;
}
};
class Earth:public planet
{
double circumference;
public:
//**2**
Earth(double d,int r)
{
circumference=2*3.1416*d;
}
//**3**
void show()
{
cout<<"the circumference is"<<circumference<<endl;
cout<<"the distance is"<<distance<<endl;
cout<<"the revolve is"<<revolve<<endl;
}
};
void main()
{
Earth obj(9300000,365);
obj.show;
}
问题提示如下:
E:\我的文件\c++源文件\练习\prog4\prog4.cpp(19) : error C2512: 'planet' : no appropriate default constructor available
E:\我的文件\c++源文件\练习\prog4\prog4.cpp(34) : warning C4551: function call missing argument list
执行 cl.exe 时出错.
请帮忙解决一下。