Inheritance through Prototypes
You can extend two types of objects. First, you can extend a class of objects. You can enhance, for example, the
Array class, thus affecting all existing and future instances of the
Array class of objects. Secondly, you can extend a particular instance of an object, not affecting any other objects of the same class. There are several ways to extend an object. You can add properties, methods, and other objects. When adding a new object to an existing one, all of the new object's properties and methods are added. Two objects can be extended by a common third object. They "inherit" the characteristics of the same object.
In this column you'll learn:
- How to extend a class of objects.
- How to extend a particular instance of an object.
- How to inherit a common object.