Lecture 9 - Inheritance


As usual, create a directory to hold today's activities:

$ mkdir ~/cs170/labs/lab9
$ cd ~/cs170/labs/lab9

Inheritance

You have now seen the How and the Why of inheritance. Today, you will see the when. Let's talk about how objects are related, and how we use that information to determine attributes and inheritance.


Lab Activity 1
Decorators

One of the biggest uses of inheritance in productions environments is to create what are known as "Decorators" for elements that are being created. We can use "abstract" decorators to describe different ways that we can decorate certain elements.

In this silly, directed example, you are going to define decorators for shape objects that are currently defined in the