5.6 Summary.
Here is a brief summary of the generic parameters, the actual syntax for generic subprograms and packages should be fairly simple to grasp.
type X is (<>); -- Discrete type
type X is range <>; -- Signed integer type
type X is mod <>; -- Modular integer type
type X is digits <>; -- Floating point type
type X is delta <>; -- Fixed point type
type X is delta <> digits <>; -- Decimal fixed point type
type X is array(..) of Y; -- Array of Y's
type X is private; -- Any definite type
type X(<>) is private; -- Any indefinite type
type X is access all Y; -- Access to object type
type X is access procedure .. - Access to procedure
type X is access function .. - Access to function
type X is tagged private; -- Any tagged type
type X is new Y with private; -- A tagged extension of Y
X : in X_Type := X_Value; -- Formal object
with procedure X(..); -- Formal procedure
with function X(..); -- Formal function
with package X is new Y(..); -- Formal package
We have introduced two new elements to our application example, the generic subprogram Ada_Store.Support.Sort and the generic package Ada_Store.Support.List.
Copyright ©
1996 Simon Johnston &
Addison Wesley Longman