7.3.3. Class Types
Every class defines a unique type. Two different classes define two different types even if they define the same members. For example:
Exercises Section 7.3.2
Exercise 7.27: Add the move, set, and display operations to your version of Screen. Test your class by executing the following code:
Screen myScreen(5, 5, 'X');myScreen.move(4,0).set('#').display(cout);cout << "\n";myScreen.display(cout);cout << "\n";
Exercise 7.28: What would happen in the previous exercise if the return type of move, set, and display was Screen rather than Screen&?
Exercise 7.29: Revise your Screen class so that move, set, and display functions return Screen and check your prediction from the previous exercise.
Exercise 7.30: It is legal but redundant ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access