= Solution
\b[<Method overloading>] gives one name several parameter signatures, such as `show(A)` and `show(B)`. The <compiler> chooses an applicable signature using the receiver's <static type> and the argument expressions' <static types>, preferring a uniquely more specific applicable alternative. An argument whose type is a <subtype> of the parameter type is acceptable; ambiguous or inapplicable alternatives cause a compile-time error. The <runtime type> of an argument does not start a second overload search.
\b[<Method overriding>] replaces an inherited implementation of the same method signature. After overload selection, ordinary instance calls use <dynamic dispatch> on the receiver's <runtime type> to select the most-derived implementation of that signature. A concrete inherited method requires the `override` keyword in Scala; a `super` call invokes the corresponding superclass implementation instead of redispatching to the overriding body. In a trait stack, `super` follows the class's linearization.<Scala 2.13 expressions specification>[Overloading resolution: applicable alternatives and most-specific selection]{ref}<Scala 2.13 classes and objects specification>[Member lookup, overriding and override modifier]{ref}
Back to article page