score:8

Accepted answer

def something(num:int):boolean and def something[s](num:s):boolean have different method signatures. the argument type of the first is int. the argument type of the second is the generic s.

class foo extends a {
  // you have to implement this abstract method
  // that is inherited from b via a.
  def something[s](num:s):boolean = ???
}

trait a extends b {
  def something(num:int):boolean = {
    num == 1
  }
}

trait b {
  def something[s](num:s):boolean
}

imagine trying to call the something[s](num:s) method inherited from b:

new foo().something[string]("x")

if you could get away with not implementing it, what would you expect to happen?

in the second example, since a inherits b[int], the class generic s is bound to int, so the method that a inherits is something(num:int), which does have the same signature as the implemented method.


Related Query

More Query from same tag