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

h05: Inheritance

ready? assigned due points
true Thu 05/11 09:30AM Tue 05/16 09:30AM

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

MAY ONLY BE TURNED IN IN THE LECTURE/LAB LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GRADESCOPE. There is NO MAKEUP for missed assignments;
in place of that, we drop the three lowest scores (if you have zeros, those are the three lowest scores.)


https://ucsb-cs32-s17.github.io/hwk/h05/

Reading: Inheritance, PS 15, PS 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.
    • WRITING (not circling!) either 11, 12, 1, or 2, to indicate your discussion section (lab) meeeting time.

    Also: For paper submission PLEASE submit on ONE SHEET OF PAPER, double-sided if at all possible. If you must submit on two printed sheets write name on BOTH sheets and no staples, paperclips, or folded corners.
    For gradescope self-submission: PLEASE get the pages in the correct order. First page of your PDF file is p1, the next is p2.

  2. (5 pts) What is the difference between calling a function and calling a method?
  3. (5 pts) What two features distinguish Object-Oriented Programming from Object-Based Programming?
  4. (6 pts) List the three kinds of polymorphism.
  5. (4 pts) State the Liksov Substitution Principle.
  6. Class D derives from (is a subclass of) class C.
       
    1. (2 pts) Should D's preconditions be more or less strong than C's?
    2.  
    3. (2 pts) Should D's postconditions be more or less strong than C's?
  7. (8 pts) List two ways in which a derived class can differ from its base class.
  8. (4 pts) If your derived class does not implement any constructors, what does the automatically-created constructor do?
  9. (4 pts) Name four methods that are automatically created if you do not implement them yourself.