Teacher Name:Mr. Rung Date of Lesson: January
Course Name: C++ Lesson Name: Chap 12.4ab
Student Name
Password
Objective To complete the wokbook exercises.
Primary Focus Answer the questions below.
Site Links Course Home Page
Additional Resources
Site Links
Question #1
The type of relationship among objects known as containment is also referred to as an is-a rela- tionship.
True False
Question #2
When a class inherits the properties of another class, the class from which the properties are in- herited is known as the parent class.
Question #3
Inheritance can be only single level.
Question #4
Users of a class do not need to know that the class is derived, as long as they know what mem- bers are available to them.
Question #5
An object created from a derived class can call a parent class's member function.
Question #6
Why is reusing a class often easier than reusing a function, especially when complex data types are involved?
A: because all their data and methods are encapsulated B: Programs communicate with objects through messages, and these messages never change. C: If a function is to be reused, parts of it may have to be rewritten to fit with the new program. D: All of the above E: None of these
Question #7
Is multiple inheritance the same thing as containment?
A: Multiple inheritance is not the same thing as containment. B: Multiple inheritance is the same thing as containment. C: Multiple inheritance can be the same thing as containment. D: All the above E: None of these
Why or why not?
Question #8
Suppose there is a class called Person. In its protected section, it has a variable named Age. Also, there is another class Student that is derived from the class Person. Does the class Student have direct access to the protected variable named Age ? .
A: Yes B: No C: Maybe D: Depends on how the class is written. E: None of these
Explain
Question #9
Suppose there is a class named Student-Group that contains several instances of the class Student described in the question above. Does the class Student-Group have direct access to the protected variable named Age in each of the instances of Student ?
A: Yes B: No C: Maybe D: Depends on how the class is written E: None of these
Explain.
Question #10
State the is-a/has-a rule in your own words.