Suppose I have the following trait with two abstract vals
trait Base {
val startDate: java.util.Date
val endDate: java.util.Date
}
I now have an abstract class extending the trait
abstract class MyAbstract extends Base ...
I now wish to instantiate the abstract class with a few other traits mixed in.
def main(args: Array[String]) {
new MyAbstract with MixIn1 with MixIn2
}
How to I pass in concrete values for startDate and endDate?
Because
MyAbstractis an abstract class, you can’t instantiate it directly. You need to either subclass it explicitly, or create an instance of an anonymous subclass, e.g.