Name and explain a reason why generics (such as generic packages in Ada
or templates in C++) are a useful feature for a
programming language to include.
(A more minor, but still legitimate, advantage is that generics allow the programmer to write a generic subprogram that takes a constant as a parameter, and this constant could be compiled into by the compiler into individual instances of the generic subprogram. For example, we could have a generic function that multiplies a number by a generic parameter.
The compiler will be able to optimize the Double routine to do a left-shift instead of a multiplication.)generic Mult : Integer function Multiply(X : Integer) return Integer is begin return Mult * X; end Multiply; function Double is new Multiply(2); function Triple is new Multiply(3);