Child Packages for Generic Packages
- The child of a generic package must itself be generic
- A generic child must be instantiated
- A generic child is instantiated using the instance of the parent package
- Let's create a child package that contains
a function that returns the size of a stack.
- This generic child does not have any parameters.
- The generic child in the next example does have parameters.
- Now let's create a child package with these operations
function size(s: Stack) return Integer (as above)
procedure put(s: Stack) (for printing the stack)
- What is required to print a stack?
- Let's see: