12.5.4 Formal Access Types

From OC Systems Wiki!
< Guide:95lrm
Revision as of 23:35, 4 May 2019 by imported>WikiVisor (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The class determined for a formal access type is the class of all access types.


formal_access_type_definition ::= access_type_definition

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).

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.


Example of formal access types:

--  the formal types of the generic package 

    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 
        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);

Copyright © 1992,1993,1994,1995 Intermetrics, Inc.
Copyright © 2000 The MITRE Corporation, Inc. Ada Reference Manual