Hello,

This has got me stumped. I've the following method for setting up the prototype chain:

Code:
var extend = function (S, E) {
	
	var F = function () {};
	F.prototype = E.prototype;
	S.prototype = new F();
	S.prototype.constructor = S;
	
	S.prototype.superc = function () {
		E.prototype.constructor.apply(this, arguments);
	};
	
	if (E.prototype.constructor === Object.prototype.constructor) {
    	    	E.prototype.constructor = E;
    	}
};
And for illustation purposes the following 'Class' definitions:

Code:
var Base = function () {
	this.init();
};

Base.prototype = {
	init: function () {
		alert('Hello');
	}
};

var ClassA = function () {
	this.superc();	
};

extend(ClassA, Base);

var ClassB = function () {
	this.superc();	
};

extend(ClassB, ClassA);
When I try to create a new ClassB object I get a "Too much recursion" error at the point it trying to call the superclass constructor:

Code:
S.prototype.superc = function () {
	E.prototype.constructor.apply(this, arguments);
};
It's probably something really obvious but I been banging my head against it for hours... can anyone shed any light?

Cheers,
WF