1
h11
CS32 F20
Name:
(as it would appear on official course roster)
Umail address: @umail.ucsb.edu section
9am, 10am, 11am, 12pm
Optional: name you wish to be called
if different from name above.
Optional: name of "homework buddy"
(leaving this blank signifies "I worked alone"

h11: Inheritance and Derived Classes

ready? assigned due points
true Thu 11/05 09:00AM Thu 11/12 11:59PM

You may collaborate on this homework with AT MOST one person, an optional "homework buddy".

MAY ONLY BE TURNED IN ON GRADESCOPE BEFORE THE DUE DATE,
There is NO MAKEUP for missed assignments;
in place of that, we drop the lowest scores (if you have zeros, those are the lowest scores.)


Reading: Inheritance and Derived Classes, PS 15.1, 15.2, DS 14.1

  1. (10 pts) Fill in the information in the header. The following are required to get the 10 "participation" points.
    • Filling in your name and umail address.
  2. For each statement, indicate if it is True or False by circling T or F. If you need to cross out an answer, be sure that your final answer is clear and unambigous—otherwise it will receive no credit.

    (3 pts) An object of a publicly derived class has access to the public methods of its base class T F
    (3 pts) An object of a base class has access to the private helper methods of its derived class T F
    (3 pts) Destructors are not inherited by derived classes T F
    (3 pts) An object of a base class has access to the private helper methods of its derived class T F
    (3 pts) An object of a derived class inherits the copy constructor of its base class T F
    (3 pts) Operators are passed down inheritance hierarchies T F
    (3 pts) Destructors in derived classes are called after their base class calls its destructor T F
    (3 pts) Constructors of base classes are accessible by derived classes T F
  3. Assume there is a class called Student that has private member variables {string name, int perm}. Assume that Student has getters and setters for each of these data members getName, setName, getPerm and setPerm, and a constructor that takes name and perm as parameters. Assume that the class is declare in file student.h

    1. (8 pts) Write the contents of a .h file for a derived a class called CmpscStudent that inherits from Student and has additional data members including {string ugradDegreeType, bool graduateStudent}. Include prototypes for a public constructor that initializes all of the data members of CmpscStudent as well as getters (but not setters) for the additional data members of CmpscStudent. Do not implement these constructors and method "inline".
       
    2. (8 pts) Write the function definition for the constructor CmpscStudent that takes as its parameters all of the data members of CmpscStudent, and fully initializes the object being constructed, as it would appears in the .cpp file.