Hi Anthony,
if you want to modify the prototype of an existing object, you are
looking for the __proto__ accessor:
c.__proto__ = p;
Assigning to 'prototype' just creates a normal property called
'prototype' but does not change the prototype chain.
-- Mads
On Wed, Nov 5, 2008 at 4:03 PM, Anthony Shipman <[EMAIL PROTECTED]> wrote:
>
> I don't understand why the following should not work
>
> function parent()
> {
> }
>
> parent.prototype.show = function()
> {
> print("parent showing\n");
> }
>
> var p = new parent();
> p.show();
>
> function child()
> {
> }
>
> // This works
> //child.prototype = p;
> //var c = new child();
> //c.show();
>
> var c = new child();
> c.prototype = p;
> c.show();
>
> --
> Anthony Shipman Mamas don't let your babies
> [EMAIL PROTECTED] grow up to be outsourced.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---