什麼是面向對象的類式繼承?

類: JS是沒有類的概念的,把JS中的構造函數看作的類 因此說類式繼承也是一種針對構造函數來作繼承的一種方式javascript <script> function Aaa() { // 父類 this.name = '小明'; } Aaa.prototype.showName = function() { alert( this.name ); }; function Bbb() { // 子類
相關文章
相關標籤/搜索