Create an object that inherits from another anonymous object:
var obj = Object.create({ func: function () { alert('Inherited method'); } });
Now obj inherits the func method from this anonymous object (the obj prototype link points to this anonymous object).
obj.func(); // alerts 'Inherited method'
But if we assign the func property to obj itself, the inherited func property will be obscured :
obj.func = function () { alert('Own method'); }; obj.func();
Live demo: http://jsfiddle.net/PLxHB/
Now, if we want to call this shadow func method (the one that warns the 'Inherited method' ), what would be a good way to do this?
I already found one solution - see here - but it's kind of a hack.
source share