Skip to content

Instantly share code, notes, and snippets.

@remeniuk
Created November 7, 2010 20:16
Show Gist options
  • Save remeniuk/666384 to your computer and use it in GitHub Desktop.
Save remeniuk/666384 to your computer and use it in GitHub Desktop.
sealed trait Base[T] {
val s: Option[String]
def copy(s: Option[String]) : T
}
case class CaseClass(override val s: Option[String] = None) extends Base[CaseClass] {
override def copy(s: Option[String]) = CaseClass(s)
}
def method[T <: Base[T]](base : Base[T]): T = {
base copy (s = Some("strng"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment