Exercises in this lecture               Go to the notes, in which this exercise belongs -- Keyboard shortcut: 'u'   Alphabetic index   Course home      

Exercise 8.2
Parameter variance


First, be sure you understand the co-variance problem stated above. Why is it problematic to execute aref.Op(sref)in the class Client?

The parameter variance problem, and the distinction between covariance and contravariance, is not really a topic in C#. The program with the classes A/B/S/T on the previous page compiles and runs without problems. Explain why!


Solution