9. With static binding, the determination of which function to call for an object occurs at compile time. With dynamic binding, the determination of which function to call for an object occurs at run time. 10. Identify the objects and operations, determine the relationships among the objects, and design the driver. 11. Use a built-in data type, use an existing ADT, or create a new ADT.
Exam Preparation Exercises
1. Define the following terms:
structured design
method (of an object)
code reuse
is-a relationship
state(of an object)
has-a relationship
instance variable (of an object)
2. In C++, inheritance allows a derived class to access directly all of the functions and data of its base class. (True or False?)
3. Given an existing class declaration
class Sigma
{
public:
void Write() const;
.
.
.
private:
int n;
};
a programmer derives a new class Epsilon as follows:
class Epsilon : Sigma
{
public:
void Twist();
Epsilon( /* in */ float initVal );
private:
float x;
};
Then the following client code results in a compile-time error:
Epsilon someObject(4.8);
someObject.Write(); // Error
a. Why is the call to the Write function erroneous?