账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    为什么会有多种继承实现方式啊,感觉这样就能很好实现继承啊
    47
    0

    看到有好多方法实现继承,什么组合式继承、寄生式继承,有的还有好多缺点,感觉下面这样或者es6都能很好实现继承啊,为什么还会有以上那些方法

    function Parent(name) {
      this.name = name
    }
    Parent.prototype.getName = function() {
      console.log(this.name)
    }
    
    function Child(name) {
      Parent.call(this, name)
      this.*** = ***
      ///
    }
    Child.prototype = Object.create(Parent.prototype)
    child.prototype.fn = function***
    ///
    1
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部