Created
November 16, 2012 18:44
-
-
Save flyx/4089807 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
type Model is interface; | |
type Model_Reference is access all Model'Class; | |
type Container is tagged record | |
Contents : Model_Reference; | |
end record; | |
procedure Set_Model (Object : in out Container; Value : Model'Class) is | |
begin | |
-- not working because initialization is missing: | |
Object.Contents := new Model'Class; | |
-- not working because aggregate expects (unknown) values of Model's fields | |
Object.Contents := new Model'Class'(Value); | |
end Set_Model; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment