Lecture overview -- Keyboard shortcut: 'u'  Previous page: Parameter Variance -- Keyboard shortcut: 'p'  Next page: Abstract Classes - Sealed Classes [Section] -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 4 : 37
Object-oriented Programming in C#
Abstract classes, Interfaces, and Patterns
Covariance and Contravariance

  • Covariance: The parameters S and T vary the same way as A and B

Class B is a subclass of class A, and the parameter class T is a subclass of S.

  • Contravariance: The parameters S and T vary the opposite way as A and B

Class B is a subclass of class A, and the parameter class S is a subclass of T.

Go to exerciseParameter variance