The last discussion about the inherit

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

posted @ 2019-08-18 01:59  dami.white  阅读(177)  评论(0编辑  收藏  举报