Shared Property (Definition)

A property contained in a prototype and shared between several instances.

Availability:

ECMAScript edition - 2

You can create several objects and make them share a common ancestor. In a class-based object oriented world, this would be called sub-classing. Instantiating each one means it would inherit properties from its super-class, but objects of the same class in a real object oriented system do not share property values unless the static (class) factory method that instantiates them presets the same values as they are initialized.

In JavaScript, because the prototype chain is used to inherit properties from parent objects and not parent classes, then objects will inherit property values unless they override them locally.

If you are used to the class-based object oriented way of doing things, this can be quite distracting.

See also:Prototype Based Inheritance, Prototype chain, prototype property

insert figure 0023

Cross-references:

ECMA 262 edition 2 - section - 10.1.4