【发布时间】:2013-02-03 10:01:53
【问题描述】:
我希望使用与 Ruby 提供的静态方法 'inherited' 相同的方法,正如您在其文档中看到的用于模块操作目的:
class Foo
@inherited: (subclass) ->
console.log('hey hou')
class Hey extends Foo
class Hou extends Foo
输出:
=> hey hou
=> hey hou
如何使用 Coffeescript 'extends' 实现这一点?我的意思是,如果我使用 Backbone.js 的“扩展”方法,我可以覆盖它。但 Coffeescript 会编译它,但这是不可能的。
有什么想法吗?
【问题讨论】:
标签: javascript inheritance backbone.js module coffeescript