Given traits:
trait HasSize {
def size() : Int
}
trait StorageTrait extends HasSize {
def something() : Unit
}
trait YetAnotherStorageTrait extends HasSize {
def anotherSomething() : Unit
}
I want to create class
class InMemoryStorage extends StorageTrait with YetAnotherStorageTrait {
//...
}
now, method size of StorageTrait returns different thing than method YetAnotherStorageTrait (it's still a size, but of different collections).
What is the correct way to design such case in Scala?