by Rob Locher
There are some interesting things to note about this example:
Note how first the prototype method is called, then a method is added to the object which hides the method in the prototype.
Bernie Seabrook never bothered with prototypes. He created complex object hierarchies by having the constructor of a derived object create an instance of the base object, and then modifying that instance. Once you've seen the idea it seems obvious, but I've never seen it documented anywhere but right here. See the following example:
Why not combine the two techniques? What I mean is that it is possible to put an object's methods in its prototype for efficiency, and still use parasitic inheritance as your inheritance mechanism.
Assuming you are using parasitic inheritance with prototypes, here are the general patterns to follow.
Here are some tips I discovered: