❔ Covariance and Contravariance C#
So I stumbled on this topic and I dont seem to grasp it properly, though I saw the following example somewhere:
Both now can call
Both now can call
func(), but b cannot call fuc() too as its treated as a Base (reference) type. Now in C++, you'd just cast b to Derived and it'd work and be perfectly valid code. The sources I looked at, mentioned that this is why covariance/contravariance exists?