In Scala, I'm trying to produce a generic set of checks to run on some data.
My base trait looks something like this:
trait Check[T]
{
def complete() : Boolean = ...
def passed() : Boolean = ...
def update[T]( data : T ) : Unit
}
Then I've got two sub-traits which look a bit like this:
trait CheckFoo extends Check[Foo]{ val baz = 1 }
trait CheckBar extends Check[Bar]{ val baz = 2 }
which are designed to avoid me defining baz in each Foo and Bar check.
Then I've got some actual Foo checks, e.g.
class CheckFooOne extends CheckFoo
{
def update( data : Foo ) : Unit = ...
}
But this doesn't compile: it tells me that CheckFooOne must be abstract, as method update is not defined.
What have I done wrong? I'm sure there's some subtlety I've missed. I'm sorry if there's another question like this already, but I can't think of what to search for, and I've checked the list of similar questions without joy.