Development & Middleware
-
-
45'
The topic is the covariance of non-generic parameters in the languages PL/SQL, C ++, Eiffel, Java, Scala, Kotlin (except PL/SQL, the order of other languages is the order of their occurrence).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 Food / Grass.In one procedure of the Animal class there is a parameter of the Food class.Can we (in the languages listed above) in the Cow subclass make an overridden procedure that uses the Grass class instead of the Food class?One language had this feature from the beginning (late 80's), but this feature allowed a runtime error, which was resolved only in 2015.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).