• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. Inheritance > About inheritance

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.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint