E07060: 'override' is not required on a constructor
What went wrong
You've marked a constructor with 'override', but constructors don't participate in method overriding - each class defines its own constructors.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 775 (Why can't a constructor use the override keyword in EK9?)
How to fix it
- Remove 'override' from constructor
- Use super() to call parent constructor
- Constructors are independent in each class
Common causes
- Confusion about constructor inheritance
- Copy/paste from regular method
- Misunderstanding override semantics
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07060: 'override' is not required on a constructor
#!ek9 defines module error.e07060.bad defines class Base as open default Base() Derived extends Base //Constructors are never inherited, so there is nothing to override override Derived() super()
Fixed: Remove 'override' from the constructor
#!ek9 defines module error.e07060.good defines class Base as open default Base() Derived extends Base Derived() super()
Questions and answers
These Q&A entries show E07060 and its fix:
Found a problem?
If EK9 reported E07060 for a program you think is valid, or did not report it where it should have, use the compiler form with the smallest program that shows it. If this page is wrong or unclear, use the documentation form. Both are at github.com/ek9lang/ek9-issues.