Last active
March 2, 2016 23:13
-
-
Save mbarnett/9c6701fe74524a6df522 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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