11Inheritance and Polymorphism
Superclasses and Subclasses
Inheritance is what a person gets from his or her parents. In AS2 programming terms, inheritance is what a “subclass” gets from its “superclass”. As discussed earlier in this book, classes provide a convenient way to group related methods and properties (functions and variables) together. But the real advantage of using classes is that one class can inherit the methods and properties of another. If a number of classes all need to share a core set of methods and properties then rather than define these methods and properties multiple times, they can be defined once in a superclass and then inherited by subclasses.
Fruit – A Superclass
If inheritance is a new concept, then it may be helpful ...
Get Understanding Macromedia Flash 8 ActionScript 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.