6 Nov 2018: Comparing Objects
Instructions
-
Spend approx 5 minutes reviewing and running the following code:
-
Fork (make a copy of) this repl.it.
-
Create one
Dateobject for each group member.-
Each group member should pick a date of personal significance (birthday, etc.), and an associated object name.
-
-
Write a definition for the
equalsmember function inDate.h. -
Use your new member function to compare each object to the others.
-
Use the example code to write a definition for the
greatermember function. -
Write a definition for the
lessmember function that usesequalsandgreater. -
BONUS Write a member function that returns true if the month and day match (i.e., check if the calendar day matches).
8 Nov 2018: Operators and Friend Functions
Instructions
-
Spend approx 5 minutes running and reviewing the following code:
-
Fork (make a copy of) the above repl.it.
-
Add one
coutstatement inside each operator that prints outd1(the first date). -
Bonus Modify the definition of
operator<infriend.hby adding or removing a single!so that the program prints "Time Warp!"