文件名称:zeng
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:982byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
有一个汽车类vehicle,它具有一个需传递参数的构造函数,类中的数据成员——车轮个数wheels和车重weight放在保护段protected中;它有一个返回车轮个数的公有函数get_wheels,有一个返回车重的公有函数get_weight,有一个计算每个车轮的承载重量(车重除以车轮数)的公有函数wheel_load,一个公有的打印函数print,它将输出vehicle的车轮数和重量。
小车类car是它的私有派生类,包含一个私有数据成员载客量passenger_load,定义小车类的构造函数,一个获得载客量数目的公有成员函数get_passengers,一个公有的打印函数,它将输出小车的车轮数、重量和载客量。
卡车类truck也是它的私有派生类,包含两个私有数据成员载客量passenger_load和载重量payload,定义卡车类的构造函数,一个获得卡车载客量的公有函数get_passengers,一个获得卡车载重效率的公有函数efficiency(计算方法为载重量/(载重量+卡车本身的重量),一个公有的打印函数print,它将输出卡车的车轮数、重量、载客量和卡车载重效率)。
在car类和truck类中均可以直接访问vehicle类中的wheels和weight。
主函数中定义小车类对象car1(4,1000,5),卡车类对象tru1(10,5000,3,34000),然后调用car1和tru1的print函数。-There is a car class vehicle, it has a need to pass parameters to the constructor, the class data members- the number of wheels and vehicle wheels, heavy weight on the protection of the protected segment it has a number of public functions to return the wheel get_wheels, there is a return to the public function of vehicle weight get_weight, there is a calculation of the weight of each wheel load (vehicle weight divided by the number of wheels) in the public function of wheel_load, a public print function of print, it will output the number and weight of vehicle wheels.
Car class car is its private derived class that contains a private data member patronage passenger_load, the definition of small car class constructor, a number of public access to patronage member functions get_passengers, a public print function, it will output trolley wheel number, weight and capacity.
Pickup truck is also its private derived class contains two private data members of the load carrying capacity p
小车类car是它的私有派生类,包含一个私有数据成员载客量passenger_load,定义小车类的构造函数,一个获得载客量数目的公有成员函数get_passengers,一个公有的打印函数,它将输出小车的车轮数、重量和载客量。
卡车类truck也是它的私有派生类,包含两个私有数据成员载客量passenger_load和载重量payload,定义卡车类的构造函数,一个获得卡车载客量的公有函数get_passengers,一个获得卡车载重效率的公有函数efficiency(计算方法为载重量/(载重量+卡车本身的重量),一个公有的打印函数print,它将输出卡车的车轮数、重量、载客量和卡车载重效率)。
在car类和truck类中均可以直接访问vehicle类中的wheels和weight。
主函数中定义小车类对象car1(4,1000,5),卡车类对象tru1(10,5000,3,34000),然后调用car1和tru1的print函数。-There is a car class vehicle, it has a need to pass parameters to the constructor, the class data members- the number of wheels and vehicle wheels, heavy weight on the protection of the protected segment it has a number of public functions to return the wheel get_wheels, there is a return to the public function of vehicle weight get_weight, there is a calculation of the weight of each wheel load (vehicle weight divided by the number of wheels) in the public function of wheel_load, a public print function of print, it will output the number and weight of vehicle wheels.
Car class car is its private derived class that contains a private data member patronage passenger_load, the definition of small car class constructor, a number of public access to patronage member functions get_passengers, a public print function, it will output trolley wheel number, weight and capacity.
Pickup truck is also its private derived class contains two private data members of the load carrying capacity p
相关搜索: zeng
(系统自动生成,下载前可以参看下载内容)
下载文件列表
zeng.txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.