title: Scala abstract class method that returns a new corresponding class child object
body: <p>I have the following class in my mind:</p>
  
  <pre><code>abstract class MyClass (data: MyData) {
  
    def update(): MyClass = {
      new MyClass(process())
    }
  
    def process(): MyData = {
      ...
    }
  
  }
  </code></pre>
  
  <p>However, abstract classes cannot be instantiated so the line <code>new MyClass(process())</code> is an error. My question is - is there any way to tell the compiler that in case of each of the child classes of MyClass I want to create an object of exactly that child class? It seems an overkill to write this method awhole in all child classes. Playing with type parameters of the class or method I could not acheive that myself.</p>