我希望使用与 Ruby 提供的静态方法 “继承”相同的方法,正如您在其文档中看到的用于模块操作目的的方法:
class Foo
@inherited: (subclass) ->
console.log('hey hou')
class Hey extends Foo
class Hou extends Foo
输出:
=> hey hou
=> hey hou
我怎样才能用 Coffeescript 'extends' 做到这一点?我的意思是,如果我使用 Backbone.js 'extend' 方法,我可以覆盖它.. 但是 Coffeescript 编译它,这是不可能的。
有什么想法吗?