Skip to content

Method binding and super method in constructor wrong order #2823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ia3andy opened this issue Mar 12, 2013 · 4 comments
Closed

Method binding and super method in constructor wrong order #2823

ia3andy opened this issue Mar 12, 2013 · 4 comments

Comments

@ia3andy
Copy link

ia3andy commented Mar 12, 2013

When I do something like that:

class A
  constructor: (toto, titi) ->
    @_toto = toto
    @_titi = titi

  sayHello: () =>
   alert("A")

class B extends A
  constructor: (@toto, @titi, @tutu) ->
    super(@toto, @titi)
    @_tutu = tutu

  sayHello: ()=>
    alert("B")

b = new B("ttt", "titit", "titi")
b.sayHello()

Binding (=>) in B is done before super call, so sayHello B is binded too soon and overrided by sayHello A. Is it normal?

@vendethiel
Copy link
Collaborator

#2773 and the ones linked there

@ia3andy
Copy link
Author

ia3andy commented Mar 12, 2013

Thanks buddy I've looked but I didn't find the good words to find it ...

@vendethiel
Copy link
Collaborator

Yep, you have to know the jargon. Please close if it's okay ;).

@ia3andy
Copy link
Author

ia3andy commented Mar 12, 2013

;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants