Dependency issue in inheritance chain
- by Razer
I have a class in coffeescript a class layout like the following.
class @A
foo: ->
console.log('foo')
class @B extends A
fooB: ->
@foo()
class @C extends B
fooC: ->
@foo()
I tried this in interpreters, it works. However it raises errors, when executing this in the browser (all of them are in separate coffee files, and are used in a global context. Therefore the @ before the class):
Uncaught ReferenceError: B is not defined application.js
It seems that B is defined after the definition of C. How can this happen?