1.首先通过一个函数来实现JS的单继承。使用原型方式来实现继承
1 (function () { 2 3 $.extend({ 4 oop: { 5 extend: function (child, father) { 6 if (father == null) { 7 var father = function () { }; 8 console.log(this); 9 father.prototype = this 10 } 11 child.prototype = new father(); 12 13 child.base = father; 14 child.prototype.base = child.prototype; 15 } 16 } 17 18 }); 19 window.oop = $.opp; 20 })();