fyqt.net
当前位置:首页 >> 用C++定义BoAt与CAr两个类,二者都有wEight属性,... >>

用C++定义BoAt与CAr两个类,二者都有wEight属性,...

#include using namespace std; class Car; class Boat { private: int Boatwe; public: Boat() //无参数构造函数 { Boatwe=500; } friend int totalWeight(Boat &,Car &);//注意这里 }; class Car { private: int Carwe; public: Car( ) //无参...

小车

你这个错误可多了... 1.float totalWeight(boat a,car b); 这个函数名 跟类名重复了 而且他的两个参数是类类型的 但是在编译 到这句的时候 他不知道boat 和 car 是什么 所以这个函数名要改一下 然后放到main 函数上边 2.class totalWeight{ floa...

class Car; class Boat { public: int weight; friend int totalWeight(Boat &boat, Car &car); }; class Car { public: int weight; friend int totalWeight(Boat &boat, Car &car); }; int totalWeight(Boat &boat, Car &car) { return boat.w...

改的如下! #include #include using namespace std; class Car; class Boat { public: int weight; friend int totalWeight(Boat &boat, Car &car); Boat(int a):weight(a){} }; class Car { public: int weight; friend int totalWeight(Boat ...

在 class Boat 上面一行 写 class Cat;

//AS3.0 class BOAT { public var weight:Number; } class CAR { public var weight:Number; }

class Car; class Boat { public: Boat(int iWeight) { weight = iWeight ; } private: float weight ; friend float addw(Boat boat,Car car); }; class Car { public: Car(int iWeight) { weight = iWeight ; } private: float weight ; frien...

class Car; class Boat { public: Boat(int iWeight) { weight = iWeight ; } private: float weight ; friend float addw(Boat boat,Car car); }; class Car { public: Car(int iWeight) { weight = iWeight ; } private: float weight ; frien...

网站首页 | 网站地图
All rights reserved Powered by www.fyqt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com