NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
JavaScript doesn't have inheritance? (Score:1)
Suppose that object A is object B's prototype and object B is object C's prototype and you add a method to A. Then C can call that method.
This sure looks like inheritance to me!
Reply to This
Re: (Score:1)
That was my first thought too but *technically* C is a clone of B which is a clone of A, so there is no inheritance. Wikipedia's page on prototype programming (http://en.wikipedia.org/wiki/Prototype-based_programming) helped clarify it for me.
Re: (Score:1)
Sorry, but your technicality is simply wrong. If C was simply a clone of B then after the cloning operation B and C would be separate but equal. But if you create C then add properties to B, C will see those new properties. The converse is not true, new properties added to C are not visible to B. The relationship between an object and its prototype in JavaScript is not a straightforward cloning operation. Instead the newly created object (ahem) inherits properties from the prototype, which may in turn