In UML, each box represents a class, indicated by the class name. Lines coming from the top of Triangle,
Rectangle, and Pentagon converge and point at Shape, indicating that each of these classes inherits from
Shape. Likewise, the arrow pointing from Square to Rectangle indicates the inheritance relationship
If you are interested in learning more about UML, refer to Instant UML (Wrox Press, ISBN
In order to implement inheritance in ECMAScript, you start out with a base class from which to inherit.
All developer-defined classes are candidate base classes. As a security precaution, native or host objects
cannot be base classes; this prevents giving the public access to compiled browser-level code that could
potentially be used in a malicious way.
After the base class has been selected, you can proceed to create its subclasses. It’s completely up to you
whether or not the base class should be used at all. Sometimes, you may want to create a base class that
isn’t intended to be used directly. Instead, it only provides common functionality to subclasses. In this
case, the base class is considered
07_579088 ch04.qxd 3/28/05 11:36 AM Page 104