vb2005xu 发表于 2013-2-4 21:00:30

// js 原型继承

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); 
页: [1]
查看完整版本: // js 原型继承