Question: 12. Suppose that you define a new class called foo. For two foo objects x and y, you would like the expression xty to be

12. Suppose that you define a new class called foo. For two foo objects x and y, you would like the expression xty to be a new foo object. What is the prototype of the function that you must write to enable expressions such as x+y? 13. I have written a class with an operator+ which is not a member function, but the operator+ implementation does access the private member variables of objects in the class. What did I need to do to gain this access? 14. Write one clear sentence telling me when it would be appropriate to declare a function as a friend of some class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
