The last discussion about the inherit

纵饮孤独 提交于 2019-11-27 16:07:16

point about inherit:

  1:subclass can get SuperClass`s message

  2:subclass rewrite SuperClass`s message

  3:many subclass Share a piece of memory

 

the inherit plan in javascript

  1:subClass get superClass by __proto__

  2:subClass can reWrite superClass

  3:when subClass initialize,is must initialize superClass by call

  

the principle about instence

  current instence keeping find the attrbute by __proto__,such as:

  

var a = new A();
a instence Object?

  1:a.__proto__ != Object.prototype

  2:a.__proto__ -> A.prototype so we judge:A.prototype.__proto__ == Object.protype

  so a.__proto__.__proto__ == Object.protype, so a instence A is true

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!