12.5.4 Formal Access Types
The category determined for a formal access type
is the category of all access types.
Syntax
Legality Rules
For a formal access-to-object type, the designated
subtypes of the formal and actual types shall statically match.
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). If and
only if the formal subtype excludes null, the actual subtype shall exclude
null.
For a formal access-to-subprogram subtype, the designated
profiles of the formal and the actual shall be subtype conformant.
Examples
Example of formal
access types:
-- the formal types of the generic package
generic
type Node is private;
type Link is access Node;
package P is
...
end P;
-- can be matched by the actual types
type Car;
type Car_Name is access Car;
type Car is
record
Pred, Succ : Car_Name;
Number : License_Number;
Owner : Person;
end record;
-- in the following generic instantiation
package R is new P(Node => Car, Link => Car_Name);
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe