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 也不配对
    
    评论

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏