有如下程序,下列关于程序的描述中,正确的是。 #i

有如下程序,下列关于程序的描述中,正确的是()。

  #include<iostream> using namespace std; class Boat; class Car{ 
public: Car(int i):weight(i){} 
friend int Total(const Car &c,const Boat &b); 
private: int weight; }; class Boat{ public: Boat(int i):
weight(i){} friend int Total(const Car &c,const Boat &b); 
private: int weight; }; int Total(const Car &c,const Boat &b)
{ return c.weight+b.weight; } i
nt main(){ Car c(10); Boat b(8); cout<<"The total weight is "<<Total(c,b)<<endl; return 0; }
答案
A

题目信息

题号:6146
题型:单选题
难度:普通