Chapter 6. Understanding Interfaces in ActionScript 2.0

 <  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  >  


Object-Oriented Programming with ActionScript 2.0
Object-Oriented Programming with ActionScript 2.0
ISBN: 0735713804
EAN: 2147483647
Year: 2004
Pages: 162

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net