Question: The pre - and post - increment operators are similar to the add operations, but, as unary operators, each of them adds a single minute
The pre and postincrement operators are similar to the add operations, but, as unary operators, each of them adds a single minute to the time stored in the calling object. Recall that the difference between pre and postincrement operators is essentially that the preincrement operator changes the calling object and then returns a reference to it while the postincrement operator copies the calling object and returns its original value after changing the original object.
Hints
Suggested order
Id suggest writing these operators in the following order:
Output operator : Testing every other operator is easier when you can print the result, and it's easy to declare and initialize Time objects
Input operator : This operator is only used in the first two test caseswe don't combine input tests with any other operator testsbut moving on to this one is a logical extension of the output operator.
Comparison operators : All of these operators are similar, and checking how two Times compare to one another is relatively straightforward.
Arithmetic operators : Understanding how to correctly add and subtract Time objects is the hardest part of this assignment, in my opinion. There are a couple of special cases to account for, as described below. I recommend handling the simple and operators before the augmented assignments and
Increment operators : The increment operators are definitely simpler than the add and subtract operators, but you have to understand addition to write these correctly.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
