circle类和table类派生roundtable类

不能通过指针为字符串赋值吧。

看不懂你写这个程序的意图,既然用的继承,何必roundtable类又声明继承过来的成员呢?

分析你的目的,可将程序写成:

#include <iostream>

#include <string>

using namespace std;

#define PAI 3.14

class roundtable

{

public:

void iniroundtable(double G,double B,string Y)

{

GaoDu=G;

BanJing=B;

YanSe=Y;

}

void display()

{

cout<<"Yuan Zhuo de GaoDu : "<<GaoDu<<endl;

cout<<"Yuan Zhuo de YanSe : "<<YanSe<<endl;

cout<<"Yuan Zhuo de MianJi : "<<PAI*BanJing*BanJing<<endl;

}

protected:

double GaoDu,BanJing;

string YanSe;

};

int main()

{

double G,B;

string Y;

cout<<"Shu Ru Yuan De BanJing :";

cin>>B;

cout<<"Shu Ru Zhuo De GaoDu :";

cin>>G;

cout<<"Shu Ru Zhuo De YanSe :";

cin>>Y;

roundtable YuanZhuo;

YuanZhuo.iniroundtable(G,B,Y);

YuanZhuo.display();

return 0;

}