Inheritance through Prototypes: Final Thoughts - | WebReference

Inheritance through Prototypes: Final Thoughts -

A Final Word

In this column we showed you how to take advantage of JavaScript's object-oriented capabilities using constructors, methods, and prototypes. We started with extending both intrinsic and user-defined classes of objects with the prototype property. We demonstrated this capability with JavaScript's Array and String objects. We then explained you how to use object extension in order to differentiate between instances of the same class, practically giving you two types of objects that inherit their essence from a base class. Finally, we described a true inheritance mechanism, implemented by extending two different objects with a common third one. We used our animation scripts from Column 19 to demonstrate the inheritance concept.

In this column you have learned:

We have shown you the code of the simple animation script, the nested animation script, and the shared animation library. You can also download the zipped version of the library.

Produced by Yehuda Shiran and Tomer Shiran

Created: January 18, 1999
Revised: January 18, 1999