When i run this code:
class Dog
constructor: ()->
@dog_name = "tulio"
the_bird = new Bird()
the_bird.bird_sing(@the_method)
@say_name()
the_method: ()->
@dog_name = "james"
say_name: ()->
alert @dog_name
class Bird
bird_sing: (callback)->
callback()
the_dog = new Dog()
why the alert is sayng "tulio" instead of "james"? Aparently the callback dont know about this(@) how can i get "james" ?
@dog_name=this.dog_nameorthe_dog.dog_name. butthisisn't bound to the context ofDog. So its not the same variable.