Match each function definition of the binary operator + function to its correct
ID: 3738528 • Letter: M
Question
Match each function definition of the binary operator + function to its correct description. Assume that functions defined outside of the class are appropriately prototyped in the class.
1) foo foo::operator+(foo f) { . . . . }
2) foo operator+(foo f1, foo f2) { . . . . }
3) friend foo operator+(foo f1, foo f2) { . . . . }
4) foo operator+(foo f) { . . . . }
a) member defined in the class
b) member defined out of the class
c) non-member defined in the class
d) non-member defined out of the class
Explanation / Answer
1) foo foo::operator+(foo f) { . . . . }
Ans) b) member defined out of the class
_____________
2) foo operator+(foo f1, foo f2) { . . . . }
Ans) d) non-member defined out of the class
_____________
3) friend foo operator+(foo f1, foo f2) { . . . . }
Ans) c) non-member defined in the class
_____________
4) foo operator+(foo f) { . . . . }
Ans) a) member defined in the class
_____________Thank You