由浅入深讲解Javascript继承机制与simple(2)

var Human = Class.extend({ init: function(age,name){ this.age = age; this.name = name; }, say: function(){ console.log("I am a human"); } }); var Man = Human.extend({ init: function(age,name,height){ this._super(age,name); this.height = height; }, say: function(){ this._super(); console.log("I am a man"); } }); var man = new Man(21,'bob','191'); man.say();

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgzyjp.html