|
|
We touched upon JavaScript's object-oriented nature several times in our previous columns. In fact, the words "Java" and "JavaScript" are often associated with OO programming and OO languages. In this column we show you how to take advantage of some of the object-oriented characteristics of the language. In particular, we show you how to extend objects with the You can extend two types of objects. First, you can extend a class of objects. You can enhance, for example, the
In this column you'll learn:
We demonstrate the inheritance concept by two animation scripts we presented in one of our previous column, JavaScript Animations, Part II. We modified the simple animation and the nested animation scripts to inherit a common object. At this point, you may view both the code for simple animation as well as the code for the nested one. You may also view the code for the shared animation library, or download its zipped version. |
Produced by Yehuda Shiran and Tomer Shiran
All
Rights Reserved. Legal
Notices.
Created: January 18, 1999
Revised: January 18,
1999
URL: http://www.webreference.com/js/column34/