Inheritance by constructor

Yehuda and Tomer Shiran describe in their WebReference.com article "Object-Oriented Programming with JavaScript, Part I: Inheritance an approach where properties and methods are immediate properties of each instance; a reference to the parent class constructor is maintained in each object; and inheritance is accomplished via calling the parent class's constructor as in:




      

do example 1

Advantages

Disadvantages

The simple approach using object constructors to inherit properties from parent classes does not meet the goals originally set for xbObject. However, the approach of maintaining a reference to the parent class's constructor merits further consideration.

home | up | topabout: