Ada Resource Association
News and resources for the Ada programming language
Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

12.5.4 Formal Access Types

1/2
The category determined for a formal access type is the category of all access types. 

Syntax

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/2
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. 
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);

Contents   Index   References   Search   Previous   Next 
Ada-Europe Sponsored by Ada-Europe