文件名称:Package
介绍说明--下载内容来自于网络,使用问题请自行百度
设计一个Package的继承层次:
1)基类Package
a) 包含寄件人姓名,收件人姓名,地址,包裹重量weight和单位重量单价price;
b) 提供构造函数;
c)提供计费函数double calculateCost(),根据单位重量单价和包裹重量计算并返回包裹运费;
d)提供prnt函数,输出包裹基本信息和包裹运费。
2)派生类TwoDayPackage
a)继承Package,并包含两日快递服务平寄费baseCost;
b)重写基类的calculateCost函数,运费应在基类函数计算基础上再加上baseCost;
;(Designing an inheritance hierarchy for a Package: 1) Base Class Package (a) Including the name of the sender, the name of the recipient, the address, the weight of the package and the unit weight price; B) Provide constructors; C) Provide the billing function double calculateCost (), calculate and return the package freight according to unit weight unit price and package weight; D) Provide PRNT function, output package basic information and package freight. 2) Derived TwoDayPackage (a) Inherit Package and include two-day express service flat delivery fee baseCost; B) To rewrite the calculateCost function of the base class, freight should be added to the calculateCost function on the basis of the calculation of the base class function. C) Rewrite the PR)
1)基类Package
a) 包含寄件人姓名,收件人姓名,地址,包裹重量weight和单位重量单价price;
b) 提供构造函数;
c)提供计费函数double calculateCost(),根据单位重量单价和包裹重量计算并返回包裹运费;
d)提供prnt函数,输出包裹基本信息和包裹运费。
2)派生类TwoDayPackage
a)继承Package,并包含两日快递服务平寄费baseCost;
b)重写基类的calculateCost函数,运费应在基类函数计算基础上再加上baseCost;
;(Designing an inheritance hierarchy for a Package: 1) Base Class Package (a) Including the name of the sender, the name of the recipient, the address, the weight of the package and the unit weight price; B) Provide constructors; C) Provide the billing function double calculateCost (), calculate and return the package freight according to unit weight unit price and package weight; D) Provide PRNT function, output package basic information and package freight. 2) Derived TwoDayPackage (a) Inherit Package and include two-day express service flat delivery fee baseCost; B) To rewrite the calculateCost function of the base class, freight should be added to the calculateCost function on the basis of the calculation of the base class function. C) Rewrite the PR)
相关搜索: Package类
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
Package.dev | 1657 | 2019-05-19 |
Package.layout | 470 | 2019-05-19 |
TwoDayPackage.cpp | 700 | 2019-05-19 |
TwoDayPackage.h | 491 | 2019-05-19 |
Definition.h | 738 | 2019-05-19 |
main.cpp | 655 | 2019-05-19 |
OverNightPackage.cpp | 885 | 2019-05-19 |
OverNightPackage.h | 541 | 2019-05-19 |
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.