I should note that the areas that use __prototype__ fail with
__proto__ as well, which is where I'm wracking my brain.
J:
Rhino 1.7 release 2 2009 03 22
js> function A () {} A.prototype = { foo: "Quack" };
[object Object]
js> function B(){} B.prototype = { __proto__ : A.prototype, bar :
"Foo" }
[object Object]
js> var foo = new B();
js> foo instanceof A;
false
js>
On Feb 16, 10:28 am, John-Simon <[email protected]> wrote:
> I seem to be in a pickle on this one (from the Rhino shell):
>
> js> function A() {
> > } A.prototype = { foo: "Quack", };
> [object Object]
> js> function B() {} B.prototype = { __prototype__: A.prototype, bar:
> "Foo", };
> [object Object]
> js> foo = new B();
> [object Object]
> js> print (foo.bar);
> Foo
> js> print(foo.foo);
> undefined
> js> foo.__prototype__;
> [object Object]
> js> foo instanceof A;
> false
>
> Not quite sure what's going on here as this works in the Mozilla JS
> engine (i.e. the browser). Can someone suggest a better way to perform
> a.) inheritance and b.) making sure that things such as instanceof
> work correctly?
>
> Cheers,
>
> JS
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino