is there a proper way to extend a class?
the current method i’m using is this:
function base() { …
function child() { …
child.prototype = new base();
child.prototype.constructor = child;
now this is not real inheritance. for 1 reason, a base() is created even when no child() are created. and even if i create 10 child(), there is only 1 base() created (the proper inheritance will create 10 bases if i create 10 childs, 1 for each child)
is there a way to achieve real inheritance in javascript? (the main problem now is that i cannot allow base() to run until there is an explicit call to child())