It's been a while since I've used Scala, and am wondering if I am making things too difficult. Here's my little bit of code:
abstract class Datum(val model: Model) {
protected def copy(model: Model): [T <: Datum];
}
class Datum1(val model: Model)
def copy(model: Model): Datum1 = new Datum1(model)
}
The idea is that there will be many variants of DatumN, each a subtype of Datum, and each will have a "copy" method that returns an object of type DatumN. I want to be able to specify in Datum.copy that all subclasses of Datum have a copy method that returns a subtype of Datum. However, the above fails to parse at [T <: Datum]. Suggestions?
Thanks,
Ken