How do I create an abstract base class in JavaScript?

后端 未结 17 2123
無奈伤痛
無奈伤痛 2020-12-02 04:06

Is it possible to simulate abstract base class in JavaScript? What is the most elegant way to do it?

Say, I want to do something like: -

var cat = ne         


        
17条回答
  •  时光取名叫无心
    2020-12-02 05:01

    You might want to check out Dean Edwards' Base Class: http://dean.edwards.name/weblog/2006/03/base/

    Alternatively, there is this example / article by Douglas Crockford on classical inheritance in JavaScript: http://www.crockford.com/javascript/inheritance.html

提交回复
热议问题