In javascript, I have a object (like an abstract class) defined like
var abstractclass = function() {
};
Now I want to have some other classes extend abstractclass
. This is how I do it, but I don't think it's the best way. I just create an instance of the parent in the class, and then I just use the parent.
var abstractclassA = function() {
var parent = new abstractclass();
};
var abstractclassB = function() {
var parent = new abstractclass();
};
var abstractclassC = function() {
var parent = new abstractclass();
};
var instance1 = new abstractclassA();
var instance2 = new abstractclassB();
var instance3 = new abstractclassC();
Is there a better way?
Thanks
Usually I do this:
this way, the instance of classB will result as instance of abstractClass too