Chapter 8: Inheritance; About Inheritance - MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

CHAPTER 8
Inheritance
In
Chapter 7, "Classes,"
you learned how to write class files and how classes help you organize
code into external files. The chapter also demonstrated how you can organize class files into
related packages. This chapter aims to show you how to write more advanced classes that
extend the functionality of an existing class. This is a useful subject, because you might find
yourself extending your own custom classes or existing classes so that you can add new
methods and properties.
For more information on inheritance, see
information on methods and properties, see
page
201.
For more information on inheritance, see the following topics:

About inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

About writing subclasses in Flash. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Using polymorphism in an application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
About inheritance
In
Chapter 7, "Classes,"
you saw how you could create a class file to create your own custom
data types. Learning how to create custom class files shows you how to move code off the
timeline and into external files. Moving code into external files makes it easier to edit your
code. Now that you're familiar with the basics of creating your own custom classes, you learn
about an object-oriented programming (OOP) technique called subclassing or extending a
class, which lets you create new classes based on an existing class.
One of the benefits of OOP is that you can create subclasses of a class. The subclass inherits all
the properties and methods of a superclass. For example, if you extend (or subclass) the
MovieClip class, you are creating a custom class that extends the MovieClip class. Your
subclass inherits all of the properties and methods of the MovieClip class. Or you might
create a set of classes that extends from a custom superclass. For example, the Lettuce class
might extend from the Vegetable superclass.
"About inheritance" on page
Chapter 6, "Functions and Methods," on
301. For more
301
8

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents