By definition:
Scala supports the notion of case classes. Case classes are regular classes which export their constructor parameters and which provide a recursive decomposition mechanism via pattern matching.
What is the meaning of regular classes which export their constructor parameters?
In general I understand how you can use them.So you can have something in the lines of this:
abstract Class Vehicle
case class Car extends Vehicle
case class Plane extends Vehicle
case class SpaceShip extends Vehicle
And then apply a pattern match on each Vehicle
to see what exactly it is however isn't this possible with all classes?
x match {
case List(x): something
case Stream(x): something else
}
So what is the main difference when writing case class
instead of just class
?