I googled 1 hour but couldn't find a good answer. So here is my question: How can I inherit a class with its prototypes?
I have currently this solution: http://jsfiddle.net/RdxYN/2/
function BaseContent(a, b) {
this.propertyA = 'propertyA';
this.a = a;
this.b = b;
alert('x');
}
BaseContent.prototype.funcA = function () {
alert(this.a + ', ' + this.b);
alert(this.propertyA);
};
function ContentA(a, b) {
BaseContent.call(this, a, b);
this.funcA();
}
ContentA.prototype = new BaseContent;
ContentA.prototype.constructor = ContentA;
ContentA.prototype.parent = BaseContent.prototype;
var Content = new ContentA('c', 'd');
The only problem is, is that BaseContent is executed twice. I don't want that. Is there a better solution or a fix?