Skip to content
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

El comportamiento de initialize no se hereda #2023

Open
julian-berbel opened this issue Oct 29, 2022 · 0 comments
Open

El comportamiento de initialize no se hereda #2023

julian-berbel opened this issue Oct 29, 2022 · 0 comments

Comments

@julian-berbel
Copy link

Para el código:

class A {
  method initialize() {
    console.println("Creando un objeto!")
  }
}

class B inherits A {}

Wollok se está comportando de esta forma:

>>> new A()
Creando un objeto!
a A
>>> new B()
a B

El comportamiento del initialize se debería heredar como el de cualquier otro método. Esto como funciona ahora se puede lograr pisando el método con un llamado a super:

class B inherits A {
  method initialize() {
    super()
  }
}

Pero por otro lado esto tira un (razonable, en mi opinión) warning de que no tiene sentido pisar un método sólo para llamar a super.

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

No branches or pull requests

1 participant