fork download
  1. With Ada.Text_IO; Use Ada.Text_IO;
  2. With Ada.Integer_Text_IO; Use Ada.Integer_Text_IO;
  3.  
  4. procedure Program is
  5.  
  6. type MyClass1 is tagged
  7. record
  8. i: integer;
  9. end record;
  10.  
  11. procedure Foo(self: in out MyClass1) is
  12. begin
  13. Put_Line("foo");
  14. end;
  15.  
  16. type MyClass2 is new MyClass1 with null record;
  17.  
  18. procedure Foo(self: in out MyClass2) is
  19. begin
  20. Put_Line("foobar");
  21. end;
  22.  
  23. object_storage: MyClass2;
  24. object: MyClass1'class := object_storage;
  25. begin
  26. object.Foo;
  27. end Program;
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
gcc-5 -c -pipe -O2 test.adb
test.adb:4:11: warning: file name does not match unit name, should be "program.adb"
test.adb:26:09: no selector "Foo" for type "MyClass1'Class" defined at line 6
gnatmake: "test.adb" compilation error
stdout
Standard output is empty