W
Wei Wang
Greetings,
I find the JavaScript's Object.prototype and getter/setter mechanism
very nice. However, I need some help with extending an object with
getters/setters in the derived class. For example:
A : function () {}
A.prototype =
{
a : null,
get a : function () { return a++; }
};
B : function () {}
B.prototype = new A;
Now, I would like to define a getter/setter in B. How do I do that?
There is no way to use the same syntax as in "A.prototype = ..." above.
Thanks for your help.
Regards,
I find the JavaScript's Object.prototype and getter/setter mechanism
very nice. However, I need some help with extending an object with
getters/setters in the derived class. For example:
A : function () {}
A.prototype =
{
a : null,
get a : function () { return a++; }
};
B : function () {}
B.prototype = new A;
Now, I would like to define a getter/setter in B. How do I do that?
There is no way to use the same syntax as in "A.prototype = ..." above.
Thanks for your help.
Regards,