Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- But in java generic collections are not covariant such as:
- ArrayList<Animal> is not a supertype of ArrayList<Dog>
- type Animal is tagged null record;
- type Dog is new Animal with null record;
- type Plain_Array is array (Positive range <>) of Animal;
- type Class_Array is array (Positive range <>) of Animal'Class;
- gnatmake -c -u -f covariant_arrays.ads
- gcc -c covariant_arrays.ads
- covariant_arrays.ads:8:59: unconstrained element type in array declaration
- gnatmake: "covariant_arrays.ads" compilation error
- type Access_Array is array (Positive range <>) of access Animal'Class;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement