August 2001
Beginner
482 pages
10h 52m
English
| Q1: | Why have pointers if references are easier? |
| A1: | References cannot be null, and they cannot be reassigned. Pointers offer greater flexibility, but are slightly more difficult to use. |
| Q2: | Why would you ever return by value from a function? |
| A2: | If the object being returned is local, you must return by value or you will be returning a reference to a nonexistent object. |
| Q3: | Given the danger in returning by reference, why not always return by value? |
| A3: | There is far greater efficiency in returning by reference. Memory is saved, and the program runs faster. |
Read now
Unlock full access