- (1)
- The class determined for a formal access type is the class of all access
types.
(2)
formal_access_type_definition ::= access_type_definition
Legality Rules
- (3)
- For a formal access-to-object type, the designated subtypes of the formal
and actual types shall statically match.
- (4)
- If and only if the general_access_modifier constant applies to the formal,
the actual shall be an access-to-constant type. If the general_access_modifier
all applies to the formal, then the actual shall be a general access-to-variable
type (see 3.10).
- (5)
- For a formal access-to-subprogram subtype, the designated profiles of the
formal and the actual shall be mode-conformant, and the calling convention of
the actual shall be protected if and only if that of the formal is protected.
Examples
- (6)
- Example of formal access types:
(7)
-- the formal types of the generic package
(8)
generic
type Node is private;
type Link is access Node;
package P is
...
end P;
(9)
-- can be matched by the actual types
(10)
type Car;
type Car_Name is access Car;
(11)
type Car is
record
Pred, Succ : Car_Name;
Number : License_Number;
Owner : Person;
end record;
(12)
-- in the following generic instantiation
(13)
package R is new P(Node => Car, Link => Car_Name);
-- Email comments, additions, corrections, gripes, kudos, etc. to:
Magnus Kempe -- Magnus.Kempe@di.epfl.ch
Copyright statement
Page last generated: 95-03-12