Question: Using C++... a) Consider the class Monkey declared below. Write the member functions declared below and the definition of the overloaded +. Modify the class
Using C++...
a) Consider the class Monkey declared below. Write the member functions declared below and the definition of the overloaded +. Modify the class declaration and write the definitions that overload the stream extraction and stream insertion operators >> and << to handle Monkey objects. Write a short driver main() program to test the overloaded operators +, <<, and >>.
Class Monkey{
public: friend Monkey operator +(const Monkey& a1, const Monkey& a2)
Monkey();
private: int allMonkeys;};
b) Write a short example involving a function that swaps two values, show the correct way to call it in a driver main() program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
