
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
312
|
Chapter 12: Objects and Classes
However, after establishing inheritance via __proto__, the super operator can still be
used to invoke a superclass’s methods. For example:
SubClass.prototype.hello = function ( ) {
super.hello( ); // Works even when inheritance is
// established through prototype.__proto__
}
Is There a Test?
While the preceding information about prototype, constructor, and __proto__ is
perhaps interesting to programming language enthusiasts, one might still wonder,
must I really know it all? Does it change my use of classes and objects?
Quite frankly, no, you should not have to know this information. The inner work-
ings of a language’s OOP implementation are not typically the concern of the lan-
guage’s users. It’s not normal for users to concoct their own OOP system, nor should
developing an OOP system be the user’s responsibility. However, ECMAScript (the
specification upon which ActionScript and JavaScript are based) was originally
designed as a lightweight scripting language. The current demands put upon it have
in some ways outstripped its expected purpose. Hence, ECMAScript developers have
been forced to take matters into their own hands, attempting to fix problems inher-
ent in the language implementation, in order to achieve their goals. Meanwhile, work
is