Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- main.adb
- with MyProc;
- procedure test is
- type MyFloat is new Float with Default_Value => 10.0;
- package P is new MyProc (MyFloat);
- Var : P.Bla;
- Var2 : MyFloat := P.Stuff (Var);
- begin
- null;
- end test;
- -- MyProc.ads
- generic
- type MyTypeWithDefault is private;
- package MyProc is
- type Bla is tagged private;
- function Stuff (Self : Bla) return MyTypeWithDefault;
- private
- type Bla is tagged record
- Data : MyTypeWithDefault;
- end record;
- end MyProc;
- -- MyProc.adb
- package body MyProc is
- function Stuff (Self : Bla) return MyTypeWithDefault is
- begin
- return Self.Data;
- end Stuff;
- end MyProc;
- generic
- type MyTypeWithDefault is private;
- Default_Value : in MyTypeWithDefault;
- package MyProc is
- type Bla is tagged private;
- function Stuff (Self : Bla) return MyTypeWithDefault;
- private
- type Bla is tagged record
- Data : MyTypeWithDefault:= Default_Value;
- end record;
- end MyProc;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement