I am trying to define the following trait in a meaningful way
trait Summable {
def +(that: Summable): Summable
}
But I would like the type of that to be the same as the type of this, so if A is Summable for instance, then we want the + to work only if that is of the type A and not any other Summable.
I could not find anyway of doing that in the doc, if someone have any idea or document I could read about that, I would be glad.
You are looking for F bound polymorphism
Now, you can creat a concrete implementation like following,
But something like following will not compile,