title: How to implement abstract function in Enum constants
body: <p>What I'm trying to achieve is a simple pattern that I'm using in Java and should be do-able in Kotlin according to the <a href="https://kotlinlang.org/docs/reference/enum-classes.html" rel="nofollow noreferrer">documentation</a>. I just want to declare an enum class with a couple of constant definitions that implement the same abstract functions.</p>
  
  <p>My problem is that I cannot manage to make my code compile. I always get the same error:</p>
  
  <p><code>modifier abstract not allowed here</code></p>
  
  <p>Here is the code:</p>
  
  <pre><code>enum class Program {
      HOME {
          override fun readableName(context: Context): String {
              return context.getString(R.string.program_home)
          }
      },
      WEEKEND {
          override fun readableName(context: Context): String {
              return context.getString(R.string.program_weekend)
          }
      },
      SHOPPING {
          override fun readableName(context: Context): String {
              return context.getString(R.string.program_shopping)
          }
      };
  
      abstract fun readableName(context: Context): String
  }
  </code></pre>
  
  <p>I have even tried with the sample code from the documentation and yet even this does not compile. </p>
  
  <p>Could anyone have an idea about this odd issue? Btw I'm currently using Kotlin 1.0.6.</p>