What is covariance and contravariance?

Junior C#

Answer

Covariance: Allows using a more derived type than originally specified.

Contravariance: Allows using a more base type than originally specified.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice