Advertisement
Guest User

Untitled

a guest
Aug 13th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. But in java generic collections are not covariant such as:
  2. ArrayList<Animal> is not a supertype of ArrayList<Dog>
  3.    
  4. type Animal is tagged null record;
  5. type Dog is new Animal with null record;
  6.    
  7. type Plain_Array is array (Positive range <>) of Animal;
  8.    
  9. type Class_Array is array (Positive range <>) of Animal'Class;
  10.    
  11. gnatmake -c -u -f covariant_arrays.ads
  12. gcc -c covariant_arrays.ads
  13. covariant_arrays.ads:8:59: unconstrained element type in array declaration
  14. gnatmake: "covariant_arrays.ads" compilation error
  15.    
  16. type Access_Array is array (Positive range <>) of access Animal'Class;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement