Amount or type of product?

Given the 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. I know this is not a recursive type - there is no recursion there.

So, is it a Sum

or Product Type

? Why?

+3


source to share





All Articles