Covariance and seven OOPLs


Technologies & Solutions

Date and time






The topic is the covariance of non-generic parameters in seven OOP languages: C++, Eiffel, Java, C#, Scala, Kotlin, Swift (the order is from oldest to youngest).In the example, covariance is attempted to be applied to two related superclass/subclass pairs.In this particular case these are the classes Animal/Cow and Animal_food/Cow_food.In one procedure of the Animal class there is a parameter of the Animal_food class.Can we (in the languages listed above) in the Cow subclass make an overridden procedure that uses the Cow_food class instead of the Animal_food class?One language had this option from the beginning (late 80's), but this feature allowed a runtime error, which was somewhat resolved only in 2014.But there is another language (among the languages listed above) that makes this possible.Note: the use of generic parameters (and their covariance) is not the "right" solution (it is a solution, but with major practical drawbacks).

Lecture details

Talk Attendence: Attendance in person
Level of difficulty: Detailed
Group of activity: Technologies & Solutions

About speaker