I use the code below in Firefox to set the prototype inheritance relationship between two objects:
var a = {};
var b = {};
b.__proto__ = a;
a.dosomething = function() {
alert('ok');
};
b.dosomething(); //ok
but it only works on Firefox due to __proto__ being only available in Firefox.
In other web browsers, if a and b were created using some constructor function, I could use
b.constructor.prototype = a;
to set the inheritance relationship.
But in the case above, the constructors of a and b are both Object.
I can not change the prototype of Object.
Is there any way to set the inheritance relationship except by using __proto__?