function subtyping is easy, just remember
you use **contra**ceptives when putting it inside and a **co**pay when taking it out
function subtyping is easy, just remember
you use **contra**ceptives when putting it inside and a **co**pay when taking it out
At the risk of learning things I may not want to know, can someone please explain this? 🤣
(Programmer by trade but did not do any undergrad CS)
@float13 @Gankra this is a mnemonic to distinguish covariance and contravariance, the two properties of arguments and return types of an inherited method signature.
When you extend a class and its methods, you can widen the argument types (contravariance - think Animal VS Dog extends Animal) but only tighten the return type (covariance - Dog VS Animal)