Generic Packages

Introduction to Generic Packages

Reminder: Formal and Actual Parameters

 Generic packages: Motivation

Generic Stack Package

Terminology: Instantiate

Strong Typing and Generic Packages

 Generic Packages vs Regular Packages

Type Parameters

Limited Private

Example Generic Packages

Enumeration IO Generic Package

  	private generic

type Enum is (<>);

package Ada.Text_IO.Enumeration_IO is
end Enumeration_IO;

Generic Queue ADT

Generic Packages and Other Languages

Defining the Problem

Java (pre 1.5, ie pre Java 5)

Java (pre 1.5, ie pre Java 5) Continued - Stack of Objects

Java 1.5 (ie 5) - Parameterized Types

Other Languages: C++

Generic Child Packages

The Problem

Generic Child Packages