Override Methods with Prototypal Inheritance

后端 未结 1 448
轻奢々
轻奢々 2021-01-22 11:03

I\'m using this clone method for prototypal inheritance from Pro JavaScript Design Patterns which is basically the same as Crockford\'s object() function. (The only difference i

相关标签:
1条回答
  • 2021-01-22 11:10

    with prototype you have to do things a little different:

    var Viewport = {};
    Viewport.prototype.inOrOut = function(){...};
    Viewport.prototype.width= function(){...};
    Viewport.prototype.height = function(){...};
    

    this way, you will be able to inherit properly...

    0 讨论(0)
提交回复
热议问题