文件名称:friend
介绍说明--下载内容均来自于网络,请自行研究使用
3、 友元
编写C++程序完成以下功能:
(1) 定义一个Boat和Car两个类,他们都具有私用属性——重量;
(2) 编写一个函数,计算两者的重量和。
double TotalWeight(Boat& b, Car& c)
-Friend write C++ program perform the following functions: (1) the definition of a Boat and Car two classes, they have private property- Weight (2) write a function to calculate the weight of both and. double TotalWeight (Boat & b, Car & c)
编写C++程序完成以下功能:
(1) 定义一个Boat和Car两个类,他们都具有私用属性——重量;
(2) 编写一个函数,计算两者的重量和。
double TotalWeight(Boat& b, Car& c)
-Friend write C++ program perform the following functions: (1) the definition of a Boat and Car two classes, they have private property- Weight (2) write a function to calculate the weight of both and. double TotalWeight (Boat & b, Car & c)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
friend.cpp