| 1 |
package Discr20 is |
| 2 |
|
| 3 |
Size : Integer; |
| 4 |
|
| 5 |
type Name is new String (1..Size); |
| 6 |
|
| 7 |
type Rec is record |
| 8 |
It : Name; |
| 9 |
end record; |
| 10 |
|
| 11 |
type Danger is (This, That); |
| 12 |
type def (X : Danger := This) is record |
| 13 |
case X is |
| 14 |
when This => It : Rec; |
| 15 |
when That => null; |
| 16 |
end case; |
| 17 |
end record; |
| 18 |
|
| 19 |
type Switch is (On, Off); |
| 20 |
type Wrapper (Disc : Switch := On) is private; |
| 21 |
function Get (X : Wrapper) return Def; |
| 22 |
|
| 23 |
private |
| 24 |
type Wrapper (Disc : Switch := On) is record |
| 25 |
Case Disc is |
| 26 |
when On => It : Def; |
| 27 |
when Off => null; |
| 28 |
end case; |
| 29 |
end record; |
| 30 |
|
| 31 |
end Discr20; |