Elektrine lite

← Feed

@alessandrolai@phpc.social

Post #2975010

2026-03-18 05:39 UTC

@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)

Replies (0)

No replies.