CS12, Lab 5

Week of February 5-9

 

 

Topics: 

·        Operator overloading

·        More practice with Unix

 

You will be further enhancing the counter class. 

All work must be done in Unix.  Files must compile with a makefile.   You may use the makefile from lab 4.

 

To do: 

·        Copy the files counter.h, counter.cc and main.cc into a new directory. 

·        Add a friend function that overloads the insertion operator << to allow printing out the value of the counter onto an output stream object.

·        Write (or modify from a previous lab) a main program (main.cc) that uses cout << to print out the value of the counter.

 

Extra credit

·        Add a method that overloads the assignment operator = to allow assigning a value to the Counter object.  Do the assignment directly or (better) using the setCount() method from lab 2.

·        Add tests of this operator to your main program.