scala - Sum or Product Type? -
given following algebraic data type:
scala> sealed trait person defined trait person scala> case class boy(name: string, age: int, x: string) extends person defined class boy scala> case class girl(name: string, age: int, y: boolean) extends person defined class girl
note - know it's not recursive type - there's no recursion involved.
so, sum
or product type
? why?
Comments
Post a Comment