So, what I want to do is to create an abstract inheritance model using traits. I think example code works best so I created this small showcase to present my problem.
trait Animals{
val owned: Seq[Animal]
type Animal <: TAnimal
trait TAnimal {
def name : String
}
}
So far so good. Now I have another trait "Dogs". The dogs are chipped so they have and identification Number. Also I want to implement the sequence containing all the dogs I have (lets say I have 5 dogs with random names and random identNo, for simplicities sake).
trait Dogs extends Animals{
type Dog <: TDog
val owned = ???
trait TDog extends TAnimal {
def identNo : Int
}
}
The Problem is, since Animal or Dog are only types I cannot create concrete instances of them. I think I can use something like Seq.fill but I'm not able to create a matching expression.