标签:
类式继承
//extend function function extend(subClass,superClass){ var F=function(){}; F.prototype=superClass.prototype; subClass.prototype=new F(); subClass.prototype.constructor=subClass; subClass.superclass=superClass.prototype; if(superClass.prototype.constructor == Object.prototype.constructor){ superclass.prototype.constructor = superClass; } } //class Person function Person(){ } //class Author function Author(){ Author.superclass.constructor.call(); } extend(Author,Person) Author.prototype.sayName=function(){ };
标签:
原文地址:http://www.cnblogs.com/byronvis/p/4515145.html