August 2001
Beginner
482 pages
10h 52m
English
| Q1: | Why would you overload an operator when you can just create a member method? |
| A1: | It is easier to use overloaded operators when their behavior is well understood. It enables your class to mimic the functionality of the built-in types. |
| Q2: | What is the difference between the copy constructor and the assignment operator? |
| A2: | The copy constructor creates a new object with the same values as an existing object. The assignment operator changes an existing object so that it has the same values as another object. |
| Q3: | What happens to the int used in the postfix operators? |
| A3: | Nothing. That int is never used except as a flag to overload the postfix and prefix operators. |
Read now
Unlock full access