Chapter 9 - Classes: A Deeper Look, Part 1
- 9.2 Time Class Case Study
- Time class definition
- Use #ifndef, #define and #endif preprocessor directives to
form a preprocessor warpper that prevents headers from being
included more than once in a program.
- Time class member function
implementation
- The throw statement (lines 28-29) creates a new object of
type
invalid_argument
.
- setfill is a "sticky" setting. Once the fill character is
specified, it applies for all subsequent values.
- Program to test class
Time
- 中文說 "下午1點27分", 英文則是 "1:27PM".
- 9.3 Class Scope and Accessing Class Members
- 9.5 Access Functions and Utility Functions
- 9.6 Constructors with Default Arguments
- 9.7 Destructors
- 9.9 Dangerous to Return a Reference to a private Data Member
- 9.10 Default Memberwise Assignment