const Member Functions
Review Questions
| 1. |
What is the main advantage of using a struct? |
| 2. |
Describe at least one difference between a class and a struct. |
| 3. |
How does class scope differ from block scope? |
| 4. |
Describe two situations where it is okay to use friend functions. |
| 5. |
How does a static data member differ from a non-static data member? |
| 6. |
What is the difference between a static member function and a non-static member function? |
| 7. |
What does it mean to declare a member function to be const? |
| 8. |
Explain what would happen (and why) if a class T had a copy constructor with the following prototype. T::T(T other); |
| 9. |
Critique the design shown in The Company Chart in Exercise 3. What problems do you see with it? In particular, how would you write Employer::getEmployees() or Position::getEmployer()? |