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 objects, 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.
Here's the code:
class Car(maxSpeed: Integer) {
// Enums
object CarType extends Enumeration {
type CarType = Value
val PERIPHERAL, COMPUTER, EMPTY = Value
}
import CarType._
// Fields
val repeated: CarType
}
When I mouse over the class name, I can see this Intellij warning:
Class 'Car' must either be declared abstract or implement abstract member 'typed: Car.this.CarType.CarType' in 'Car'
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.