title: Scala abstract type representing type of subclass
body: <p>I'm looking for a way to define a method that returns a type T where T = the type of the subclass.</p>
  
  <p>I know I could possibly do this using abstract types, but dislike the overhead of having to redefine T for each subclass.</p>
  
  <p>Some sample code:</p>
  
  <pre><code>object Helper {
    def help[A &lt;: MyClass](cls: A): Option[A] = { cls.foo() map { _.asInstanceOf[A] } }
  }
  
  class MyClass {
    type T &lt;: MyClass
    def foo(): Option[T] = Some(this.asInstanceOf[T])
  }
  
  class ChildClass extends MyClass {
     type T = ChildClass
  }
  </code></pre>
  
  <p>Possibly a new language feature has made this easier? Or can I use this.type in some way? It's important to me that I be able to define a helper class that can call into foo in this way.</p>