Class relationships bring out the full power of object-oriented programming. Inheritance allows you to create classes that specialize or extend other classes. You can create entire hierarchies of classes but there are enough gotchas that some languages have restricted inheritance. This episode will not only explain what inheritance is but give you some guidance on how to use it wisely.

Let’s say you are modeling books. You might want a class hierarchy that looks like this:
Class name: book
Base class: none

Class name: physicalBook
Base class: book

Class name: audioBook
Base class: book

In this case, both the physicalBook and audioBook classes derive from the book class. You can then put all the data and methods that’s common to all books in the book class and then add to that of even modify the book class methods in the derived classes.

You can also have multiple levels of inheritance like this:
Class name: physicalObject
Base class: none

Class name: armor
Base class: physicalObject

Class name: helmet
Base class: armor

This says that a helmet is an armor and that an armor is a physicalObject.