< Day Day Up > |
In Chapter 5, "The Meek Shall Inherit the Earth," we talked about inheritance. If you recall, an object can inherit all the members of a class. The new class is called a subclass, or descendant, and the original class becomes a superclass, or ancestor. The relationship created between subclass and superclass is one-to-one. That is, a subclass can have one, and only one, ancestor . But what if you were trying to create a class that had the properties of two ancestors? Given the rules of inheritance and what we know at this point, we cannot have two direct ancestors . This can be a problem. Fortunately, in this chapter, we investigate an object-oriented concept called interfaces , which helps us implement multiple inheritance, but with a twist. We also see how interfaces can enhance what we already know about polymorphism. |
< Day Day Up > |