博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年3月9日

摘要: 下面我们修改一下animal类的构造函数,增加两个参数height和weight,分别表示动物的高度和重量。代码如例2-13所示。例2-13#include <iostream.h>class animal{public: animal(int height, int weight) { cout<<"animal construct"<<endl; } ~animal() { cout<<"animal destruct"<<endl; } void eat() { cout<<& 阅读全文

posted @ 2011-03-09 16:01 浪端之渡鸟 阅读(497) 评论(0) 推荐(0) 编辑