Post #2975009
2026-03-17 20:01 UTC
@Gankra@toot.cat
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)
Replies (1)
-
@alessandrolai@phpc.social 2026-03-18 05:39
@float13@masto.hackers.town @Gankra@toot.cat 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)