MV Copying and calling functions from non-base prototypes

There are moments where I miss multiple inheritance in languages such as javascript. Sometimes I wish I could access the functions from two different Scene-Classes from a derived class without the need to copy the entire code from one of them, cause everybody should know: "Duplicate code is bad". Then I remembered that I once saw a plugin creator just copying a function from one prototype to another like I did in the following code example with someFunction from Scene_B.prototype to Scene_C.prototype:

JavaScript:
function Scene_A() { this.initialize.apply(this, arguments); }
Scene_A.prototype = Object.create(Scene_MenuBase.prototype);
Scene_A.prototype.constructor = Scene_A;
Scene_A.prototype.create = function() { Scene_MenuBase.prototype.create.call(this); this._testWindow = new Window_Base(0, 0, Graphics.boxWidth / 2, Graphics.boxHeight); this.addWindow(this._testWindow);}
function Scene_B() { this.initialize.apply(this, arguments); }
Scene_B.prototype = Object.create(Scene_MenuBase.prototype);
Scene_B.prototype.constructor = Scene_B;
Scene_B.prototype.create = function() { this._testWindow2 = new Window_Base(Graphics.boxWidth / 2, 0, Graphics.boxWidth / 2, Graphics.boxHeight); this.addWindow(this._testWindow2); }
Scene_B.prototype.someFunction = function() { alert("Hello World!"); }
function Scene_C() { this.initialize.apply(this, arguments);}
Scene_C.prototype = Object.create(Scene_A.prototype);
Scene_C.prototype.constructor = Scene_C;
Scene_C.prototype.someFunction = Scene_B.prototype.someFunction;
Scene_C.prototype.create = function() { Scene_A.prototype.create.call(this); Scene_B.prototype.create.call(this); this.someFunction(); }
SceneManager.push(Scene_C);

And via the call method I was also able to call a method from a prototype I even haven't derived from. I just wonder why and how is this possible and are there any drawbacks from doing that? Could someone please explain that to me!
Since Javascript doesn't actually have inheritance as such, this isn't as weird as I think you perceived it to be. If you look at the core code in MV or MZ, to "inherit" you set an object's prototype to the prototype of the parent. This basically just creates a reference link from the parent prototype to the property with the same name on the child, but there's no real "inheritance" happening here, it's just that because the child's prototype is the same as the parent's, you're able to call the same functions that were defined on that prototype.

But that doesn't mean you can't still modify the prototype of the child object and give it additional functions/properties, which approximates how class inheritance works in other languages even if it's mechanically not quite the same.
Javascript prototype works differently than class-based languages. It is better to learn how prototypes work in javascript and how a function works to understand what is going on. Here is the twist, there is no inheritance. The javascript prototype is like a prefab/blueprint/premade object that you can change or take some of the function later literally anywhere. The prototype can simply be an object that has a list of functions.

Lemme try to breakdown the code into a sentence
Code:
Scene_A.prototype = Object.create(Scene_MenuBase.prototype);
"I want to make scene A, but I need everything that Scene_MenuBase has"

Code:
Scene_C.prototype = Object.create(Scene_A.prototype);
"Scene_A, can I copy your homework?"
"Sure"

Code:
Scene_C.prototype.someFunction = Scene_B.prototype.someFunction;
"Just make sure you change a bit so it doesn't look obvious. Try to copy some from Scene_B".

are there any drawbacks from doing that?
The only drawback I could think of is. If at some point, Scene_B.prototype.someFunction is changed, maybe due to the other plugin modifying it (or aliasing it). The change might not get reflected in Scene_C.

EDIT:
To solve the issue, I would do
Code:
Scene_C.prototype.someFunction = function() { Scene_B.prototype.someFunction.call(this) }
Thank you both for the explanations!
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/copying-and-calling-functions-from-non-base-prototypes.142294/