Naming a Case Class the same as another Case Class

Is it possible to name a case class as I have already named another case class, obviously however altering of the number of parameters required i.e.

case class Value(name: String) extends Expr

case class Value(name1:String, name2:String) extends Expr

Is there any other possible that I may go around it please ?

Thanks a lot and good day :slight_smile:

It is not possible to have two classes with the same name in the same package.

You have 2 possibilities:

  • default value for the parameter name2 (or a second constructor)
  • different names of the two classes

Thanks a lot and good day :slight_smile: