E07110: implementation not provided so must be declared as abstract

Category: E07xxx Full resolution · Reported in phase: SYMBOL_DEFINITION · Classification: NOT_ABSTRACT_AND_NO_BODY_PROVIDED · All error codes

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

  1. Add implementation body to method
  2. Or mark as abstract (class must also be abstract)
  3. Every method needs either body or 'abstract' keyword

Common causes

  • Forgot to add implementation
  • Forgot to add 'abstract' keyword
  • Incomplete method definition

See also

  • E07110: non-abstract without body (this error)
  • E07100: abstract with body (opposite problem)
  • E07160: non-abstract method missing body

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: