< previous page page_a72 next page >

Page A72
Chapter 15
Case Study Follow-Up
1. The class constructor DateType() is a constructor operation. Set and Increment are transformers. Month, Day, Year, Print, and ComparedTo are observers.
Chapter 16
Exam Preparation Exercises
2. False
4. Class Abc:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
a. The private data members are alpha and beta.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
b. Functions DoThis and DoThat can reference alpha and beta
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
c. Functions DoThis and DoThat can invoke each other directly.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
d. Clients can invoke DoThis.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Class Xyz:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
a. The private data members are alpha, beta, and gamma.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
b. Function Trylt can reference only gamma directly.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
c. Function Trylt can invoke the parent class's DoThis function directly. The syntax for the function call is Abc::DoThis().
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
d. Clients can invoke DoThis and Trylt.
7. a. Member slicing occurs, and static binding is used. The output is
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
x
y
b. Member slicing does not occur, and dynamic binding is used. The output is
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
x
yz
c. Member slicing does not occur, but static binding is used. The output is
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
x
y
9. a. False b. True c. False
Chapter 16
Programming Warm-Up Exercises
2. #include <math.h>   // For sqrt()
     .
     .
     .
    float Line::Length() const

   // Postcondition:
   //     Function value == length of this line
   {

 
< previous page page_a72 next page >