I have the following class:
abstract class MyClass (data: MyData) {
def update(): MyClass = {
new MyClass(process())
}
def process(): MyData = {
...
}
}
However, abstract classes cannot be created, so the string new MyClass(process())is an error. My question is: is there a way to tell the compiler that in the case of each of the MyClass child classes, I want to create an object of this particular child class? It seems redundant to write this awhole method in all child classes. Playing with parameters like a class or method, I could not achieve this.
source
share