E07110: implementation not provided so must be declared as abstract
What went wrong
Your method has no implementation body but isn't marked 'abstract'. In EK9, methods must either have a body OR be explicitly abstract.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 773 (Why must a method either have a body or be marked abstract?)
- ek9 -q 103 (What are abstract classes and methods in EK9?)
- ek9 -q 56 (What are higher-order functions and why should I use them?)
- ek9 -q 214 (How do I implement the strategy pattern in EK9?)
How to fix it
- Add implementation body to method
- Or mark as abstract (class must also be abstract)
- Every method needs either body or 'abstract' keyword
Common causes
- Forgot to add implementation
- Forgot to add 'abstract' keyword
- Incomplete method definition
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07110: implementation not provided so must be declared as abstract
#!ek9 defines module error.e07110.bad defines class Shape as abstract //Each kind of shape works out its own area area() <- rtn as Float?
Fixed: Mark it abstract: each sub-class gives the body
#!ek9 defines module error.e07110.good.fix defines class Shape as abstract //Each kind of shape works out its own area area() as abstract <- rtn as Float?
Fixed: Mark it abstract, or give it a body
#!ek9 defines module error.e07110.good defines class Shape as abstract //Option 1: mark it abstract area() as abstract <- rtn as Float? //Option 2: give it a body name() <- rtn as String: "shape"
Questions and answers
These Q&A entries show E07110 and its fix:
- Q56: What are higher-order functions and why should I use them?
- Q103: What are abstract classes and methods in EK9?
- Q214: How do I implement the strategy pattern in EK9?
- Q649: Why must generic functions provide an implementation?
- Q773: Why must a method either have a body or be marked abstract?
- Q1031: Explain the design decisions in this EK9 code for a team wiki.
- Q1238: Implement me a strategy pattern for applying different discount calculations to a price, using an abstract function and two dynamic function strategies.
- Q1248: Implement me a chain-of-responsibility pattern using abstract function handlers, where each handler tries to process a String and either returns a result or returns unset to pass on to the next handler.
- Q1253: Create me an abstract transformer function that a dynamic function instance can extend — showing that 'as abstract' on a function makes it implicitly open.
- Q1268: Write a generic Pair class with two type parameters A and B that holds two values.