Skip to content

Instantly share code, notes, and snippets.

@flyx
Created November 16, 2012 18:44
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 flyx/4089807 to your computer and use it in GitHub Desktop.
Save flyx/4089807 to your computer and use it in GitHub Desktop.
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