Inheritance Demo | WebReference

Inheritance Demo

Shape Demo String Demo Base Class Test

This demo demonstrates polymorphism using objects from a class heirarchy.

Choose from a circle, triangle or square to view some selected attributes

See the code in function showShape(value).


This demo demonstrates extending (or subclassing) the native JavaScript String class.

The IPString class inherits from a StringBase class that wraps String

See the code in function runStringTest().

This demo demonstrates the princeple of JavaScript inheritance. Note that it doesn't use the Function.inherit() method to inherit but assigns the Base prototype manually. For this reason, the class testing code will not work completely.

See code in the function runBaseTest().