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