|
|
|
|
friend
keyword for that. When I compile your code I get these problems:src/soundsys.cpp:16:12: error: ‘get’ has not been declared src/soundsys.cpp:16:15: error: expected ‘,’ or ‘...’ before ‘.’ token src/soundsys.cpp: In function ‘int main()’: src/soundsys.cpp:38:12: error: ‘add’ was not declared in this scope src/soundsys.cpp: In member function ‘int AltMoney::add(AltMoney, AltMoney)’: src/soundsys.cpp:70:2: error: ‘sum’ was not declared in this scope src/soundsys.cpp:77:1: warning: no return statement in function returning non-void [-Wreturn-type] make: *** [obj/soundsys.o] Error 1 |
int add (get.m1, get.m2);
doesn't make sense because get, m1, and m2 are all not defined at this point. If add
is your friend function then do this:
|
|
int add (get.m1, get.m2);
In function 'int main()':| main.cpp|37|error: [b]'add' was not declared in this scope main.cpp||In member function 'int AltMoney::add(AltMoney, AltMoney)': main.cpp|69|error: 'sum' was not declared in this scope main.cpp|77|warning: no return statement in function returning non-void [-Wreturn-type] === Build finished: 2 errors, 1 warnings (0 minutes, 0 seconds) === |