When reading source code I have come across the sealed keyword in Scala programs.

Its actually a great concept:

Traits and classes can be marked sealed which means all subtypes must be declared in the same file. This assures that all subtypes are known.

source

sealed trait User {
  def email: String
  def name: String
}

class FreeUser extends User {
  def email: String = ???
  def name: String = ???
}

class PremiumUser extends User {
  def email: String = ???
  def name: String = ???
}