czssamson 2016-04-26 12:04 采纳率: 0%
浏览 1713

关于类中建立另一个含有其他类对象的对象

class FoodSeller:public Person//这个类要弄到animalfood和money类,创建对象来实施相应操作
class Zoo
{
public:
Zoo(int =0,int=0,int=0,int=0);
~Zoo();
bool judgeStatus();
private:
FoodSeller people;
AnimalEnclosure ae[3];

};
#endif
Zoo::Zoo(int p, int c, int b, int d)

:people(p, c, b,0)//此处为什么说没有办法进去,这里错误

{

}

{
FoodSeller(int,int,int,int);//调用FoodSeller的函数构造函数。注意形参列表的对应
~FoodSeller();

void setSellingPea(int);
void setSellingCar(int);
void setSellingBan(int);
void setSellingFood();

int getPeaAmount()const;
int getCarAmount()const;
int getBanAmount()const;

protected:
AnimalFood peanuts;//创建AnimalFood的具体卖的对象
AnimalFood carrots;
AnimalFood bananas;
private:
Money earnings;
};
#endif

十分紧急求帮忙

  • 写回答

1条回答 默认 最新

  • threenewbee 2016-04-26 13:37
    关注
     {
    }
    {
    多了一个引号。
    另外你的不少函数没有实现,只有定义
    #if 和 #endif 也不配对
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog