通用子程式

通用子程式可用於建立具有相同結構的子程式,用於多種型別。例如,要交換兩個物件:

generic
    type A_Type is private;
procedure Swap (Left, Right : in out A_Type) is
    Temp : A_Type := Left;
begin
    Left := Right;
    Right := Temp;
end Swap;