Constructor function
- Special member function
- Initializes data members
- Same name as class
- Called when object instantiated
- Several constructors; Function overloading
- No return type
1 class Time {
2
3 public:
4 Time(); // constructor
5 void setTime( int, int, int ); // set hour, minute, second
6 void printUniversal(); // print universal-time format
7 void printStandard(); // print standard-time format
8
9 private:
10 int hour; // 0 - 23 (24-hour clock format)
11 int minute; // 0 - 59
12 int second; // 0 - 59
13
14 }; // end class Time