日期:2014-05-16 浏览次数:20469 次
function A (){this.name='A'}
function _extend(Class,parentClass){
if (typeof parentClass == "function"){
Class.prototype = new parentClass();
}
return Class ;
}
var B = _extend(function (){this.name='B'},A);
var bORef = new B();
log(bORef);
log(bORef instanceof A);
var C = _extend(function (){this.name='C'},B);
var cORef = new C();
log(cORef);
log(cORef instanceof A);
var D = _extend(function (){this.name='D'},C);
var dORef = new D();
log(dORef,);
log(dORef instanceof A);
?
function bibao(){
var param = 21 ;
this.changeParam = function(num){
param = num ;
};
this.alert = function(){ alert(param)};
}
var test = new bibao();
test.alert();
test.changeParam(123);
test.alert();