CS3240: Data Structures and Algorithms

C++: Discussion Questions

1. Assume a class D that is privately derived from class B.  An object of class D in main() can access

a. public members of D.
b. protected members of D.
c. private members of D.
d. public members of B.
e. protected members of B.
f. private members of B.
 

 

2. A class D can be derived from a class C, which is derived from a class B, which is derived from a class A.

a. True
b. False

 

3. Assume a class D derived from a base B. Both classes contain a member function foo() that takes no arguments. Write a statement that is in a member function of D that calls foo() in the base class.

4. Write the first line of a specifier for a class AB that is derived from class A and from class B.

5. Assume a base class B with a public member function bFunc(), and class D is derived from B. Write a statement that allows an object of D to access bFunc().

 

6. It is illegal to make objects of one class members of another class.

a. True
b. False

A
© Lynne Grewe