(function() {
function A(name) { this.name=name; this.getName() }
A.prototype.getName = function(){ alert(this.name)}
B = function() { alert('foo'); };
var newA = function(name) { B(); this.constructor(name); }
newA.prototype = A.prototype;
A = newA;
new A('test');
})();