- From: François REMY <francois.remy.dev@outlook.com>
- Date: Sat, 29 Dec 2012 18:17:51 +0000
- To: Marcos Caceres <w3c@marcosc.com>
- CC: "public-nextweb@w3.org" <public-nextweb@w3.org>
Received on Saturday, 29 December 2012 18:18:20 UTC
> > // let fooInstance be an instance of Foo, got somehow from your API > > Foo.prototype.test2=Foo.prototype.test; > > fooInstance.test2(); // fail > > The above must fail, because test2 is a copy of test whose "this" has changed. This is not the real issue, as this does not work better: Foo.prototype.test2=function() {}; fooInstance.test2(); // Uncaught TypeError: Object #<Foo> has no method 'test2' The problem is that Foo.prototype is not the ‘real’ Object.getPrototypeOf(fooInstance), but an object that inherits its properties; adding more stuff on Foo.prototype doesn’t affect the other one.
Received on Saturday, 29 December 2012 18:18:20 UTC