Home > Back-end > Don't understand why a friend function can't access to appreciate
Don't understand why a friend function can't access to appreciate
Time:11-07
#include using namespace std; The class Car; The class Boat {private: int weight; Public: Boat (int b) {weight=b; } Friend int getTotalweigt (Car & amp; Acar, Boat & amp; Aboat); }; The class Car {private: int weight; Public: Car (int) c {weight=c; } Friend int getTotalweigt (Car & amp; Acar, Boat & amp; Aboat); }; Int getTotalweight (Car & amp; Acar, Boat & amp; Aboat) { Return acar. Weight + aboat. Weight; Cout<& lt;" Yes "& lt; Int main () { Boat b1 (66); The Car c1 (666); Coutcout <"Over" & lt; return 0; } Problems as follows
CodePudding user response:
The last line of the E0077 tips, which refers to the line of the problem?