[prev] [index] [next]

Structured ADTs (cont)

Note that in a similar way to Stack being opaque
  • we have not specified any details of Item
This gives scope for making different kinds of Stacks
  • e.g. StackOfInts, StackofStrings, etc.
If we define   typedef void *Item; ...
  • we can even have heterogeneous Stacks
  • with the addition of a type field for each item
  • and type-specific operations for each possible type