Reputation: 1267
Fiddle here: http://jsfiddle.net/rhodee/4NKVH/
I've been reading the Crockford book and was wondering what is a proven approach to prying open the base constructor object and adding a function to it that child objects can access?
I thought I could access the prototype of my object and it appears that is not possible given my current code.
Thanks for any ideas.
Upvotes: 0
Views: 56
Reputation: 152976
You have several errors:
this
. (If no return
statement exists, the constructor does this implicitly)MySuperclass.call(this, arg1, arg2, ...);
, so in your case mammal.call(this, spec);
in the cat
classnew
keyword to instantiate an object that uses the prototype chain.See http://jsfiddle.net/4NKVH/5/ for a fixed version of your code.
Upvotes: 1