How to use Scala Enumerations in Classes
<p>I'm learning Scala and am trying to get a simple enum setup for a project. I've checked a few examples and none seem to fit, all of the examples in the Scala documentation and on StackOverflow are for enums inside <em>objects</em>, not classes. I'm getting an IDE warning that I don't understand. I'm coming from a beginner Java background into Scala, which may be the cause of my confusion. </p>

<p>Here's the code: </p>

<pre><code>class Car(maxSpeed: Integer) {

  // Enums
  object CarType extends Enumeration {
    type CarType = Value
    val PERIPHERAL, COMPUTER, EMPTY = Value
  }
  import CarType._

  // Fields
   val repeated: CarType
}
</code></pre>

<p>When I mouse over the class name, I can see this Intellij warning:</p>

<blockquote>
  <p>Class 'Car' must either be declared abstract or implement abstract member 'typed: Car.this.CarType.CarType' in 'Car'</p>
</blockquote>

<p>I'm not sure why it wants me to implement my variable, and the class is not intended to be abstract. I'd like to use Enums similarly to how they are used in Java. </p>