var inherits = require("util").inherits;
function a(){
this.name = "lee"
}
a.prototype.sex = "male"
function b(){
this.color = "red"
}
b.prototype.height = "168"
function c(){
}
inherits(c,a)
inherits(c,b)
var c = new c()
console.log(c.height)
console.log(c.sex)
console.log(c.name)b. 輸出:

專注于為中小企業(yè)提供網站設計、成都做網站服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)汾西免費做網站提供優(yōu)質的服務。我們立足成都,凝聚了一批互聯(lián)網行業(yè)人才,有力地推動了上千企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網站建設實現規(guī)模擴充和轉變。
168
undefined
undefinedfunction a(){
this.name = "lee"
}
a.prototype.sex = "male"
function b(){
this.color = "red"
}
b.prototype.height = "168"
function c(){
}
c.prototype = new a()
c.prototype = new b()
var c = new c()
console.log(c.height)
console.log(c.sex)
console.log(c.name)b. 輸出:
168
undefined
undefined1、只支持單繼承
2、不能作用于類本身的屬性或方法(只支持prototype原型創(chuàng)建的屬性或方法)
本文題目:nodejs中的繼承
鏈接分享:http://www.chinadenli.net/article36/gpcspg.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供微信小程序、網站策劃、網站排名、動態(tài)網站、建站公司、營銷型網站建設
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)