generic_declaration ::= generic_subprogram_declaration | generic_package_declaration
generic_subprogram_declaration ::= generic_formal_part subprogram_specification;
generic_package_declaration ::= generic_formal_part package_specification;
generic_formal_part ::= generic {generic_formal_parameter_declaration | use_clause}
generic_formal_parameter_declaration ::= formal_object_declaration | formal_type_declaration | formal_subprogram_declaration | formal_package_declaration
NOTES
generic -- parameterless
generic Size : Natural; -- formal object
generic Length : Integer := 200; -- formal object with a default expression
Area : Integer := Length*Length; -- formal object with a default expression
generic type Item is private; -- formal type type Index is (<>); -- formal type type Row is array(Index range <>) of Item; -- formal type with function "<"(X, Y : Item) return Boolean; -- formal subprogram
generic type Elem is private; procedure Exchange(U, V : in out Elem);
generic type Item is private; with function "*"(U, V : Item) return Item is <>; function Squaring(X : Item) return Item;
generic type Item is private; type Vector is array (Positive range <>) of Item; with function Sum(X, Y : Item) return Item; package On_Vectors is function Sum (A, B : Vector) return Vector; function Sigma(A : Vector) return Item; Length_Error : exception; end On_Vectors;
Go to the first, previous, next, last section, table of contents.