function SubClass() {
}
SubClass.prototype = new BaseClass();
SubClass.prototype.name = "";
SubClass.prototype.sayName = function () {
alert(this.name);
};
var objA = new BaseClass();
var objB = new SubClass();
objA.color = "red";
objB.color = "blue";
objB.name = "MyName";
objA.sayColor();
objB.sayColor();
objB.sayName();
|