Theoretically, sound overrides the parent's methods in a subclass of the method, where the parameters are supertypes of parameters in the parent class, for example:
class T
def foo(s: String) = ...
class S
override def foo(a: Any) = ...
What programming languages support this “function” and how do they solve problems such as the possibility that one subclass method can override several methods of the parent class:
class T
def foo(s: String) = ...
def foo(i: Int) = ...
class S
override def foo(a: Any) = ...
(Assuming that Stringand Intsubtypes Any.)
source
share