Skip to content

Instantly share code, notes, and snippets.

@mbarnett
Last active March 2, 2016 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbarnett/9c6701fe74524a6df522 to your computer and use it in GitHub Desktop.
Save mbarnett/9c6701fe74524a6df522 to your computer and use it in GitHub Desktop.
With Ada.Text_IO; Use Ada.Text_IO;
procedure Program is
package Classes is
type Class1 is tagged
record
i: integer;
end record;
procedure Foo(self: in out Class1);
type Class2 is new Class1 with null record;
procedure Foo(self: in out Class2);
end;
package body Classes is
procedure Foo(self: in out Class1) is
begin
Put_Line("foo");
end;
procedure Foo(self: in out Class2) is
begin
Put_Line("foobar");
end;
end;
object_storage: Classes.Class2;
object: Classes.Class1'class := object_storage;
begin
object.Foo;
end Program;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment