#include<iostream>
#include<cmath>
using namespace std;
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.weight + car.weight;
}
int main()
{
Boat boat(10);Car car(10);
cout<<"The weight is: ";
cout<<totalWeight(boat,car)<<endl;
}
麻烦帮忙看看哪错了,谢谢