abstract class Parent {
def filter(p: Parent => Boolean): Parent = filterAcc(p, new Child)
}
class Child extends Parent {
// ...
}
I am working on Scala tutorial and wondering how the following can be possible.
There are two classes Parent and Child. The Parent class creates an instance of child in the method filter.
How can a parent class refer to a child class which inherits the parent class?