|
|
|
|
|
|
|
// 23:59:59 wrapping around to 0:0:0
// && IF new time is 0:0:0
// Date has been advanced to the next day
void Write() const;
// Postcondition:
// Time and date have been output in the form
// HH:MM:SS month day, year
TimeAndDay();
// Postcondition:
// Class object is constructed with a time of 0:0:0
// and a date of January 1, 1583
private:
TimeType time;
DateType date;
}; |
|
|
|
|
|
|
|
|
Chapter 17
Exam Preparation Exercises |
|
|
|
|
|
|
|
|
4. The delete operation releases the space reserved for a dynamic variable back to the system. |
|
|
|
|
|
|
|
|
5. a. inaccessible object b. dangling pointer c. dangling pointer d. neither e. inaccessible object |
|
|
|
|
|
|
|
|
7. The correct answer is (a). |
|
|
|
|
|
|
|
|
11. Constructor executing
Private data is 1
Destructor executing
Constructor executing
Private data is 2
Destructor executing
Constructor executing
Private data is 3
Destructor executing |
|
|
|
|
|
|
|
|
13. The correct answer is (e). |
|
|
|
|
|
|
|
|
chapter 17
Programming Warm-Up Exercises |
|
|
|
|
|
|
|
|
1. a. char* p = &ch;
b. long* q = arr;
or
long* q = &arr[0];
c. BoxType* r = &box;
|
|
|
|
|
|