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

Chapter 12. Objects and Classes > The Almighty Prototype Chain

12.7. The Almighty Prototype Chain

In Chapter 2, we saw that the interpreter uses a scope chain to resolve (look up the value of) unqualified variable references. To resolve property values, the interpreter uses a prototype chain. We've already encountered the prototype property in our examination of methods and superclasses. Now let's take a look "under the hood" of ActionScript's inheritance system to see how the prototype property really works. For the sake of the current discussion, the term property refers to object properties, methods, and event handlers (the latter two of which are, technically, functions stored in properties).

As we've seen, every class constructor function is automatically given a property called prototype. For example, when we create a Book class, the Book constructor automatically defines Book.prototype:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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