So I've been trying to work around this and still no good ideas. Here is an example:
var P = function()
{
writeln("running P constructor");
}
P.prototype.doSomething = function(cool)
{
writeln(cool);
}
var C = function()
{
writeln("I'm the C constructor");
}
C.prototype = new P(); // P's constructor will run here
C.prototype.constructor = C; // reset C's constructor back to the proper function
writeln("If this were another language,this would be the first output.");
a_C_instance = new C();
a_C_instance.doSomething("Execute inherited function!");
By having to make a new instance of P to inherit to C, it causes P's constructor be invoked. Object.create would have done this without invoking the constructor, but at least for me when I test with JSDB, there is no Object.create. As far as I can tell, 'new' causes an instance of an object to be created from the prototypes and invocation of the constructor.
Any ideas on how I can just create a copy of the prototypes without invoking the constructor, in this case do something like 'Object.create(P)' instead of 'new P()'.
I hope that was clear, and any help would be appreciated. Also trying not to move everything out of the constructor and into another function (like 'init()') because it would make the code messy.
Tahnks