Glossary: Container
A container
class
is one whose function is manage a collection of objects of another class.
Arrays, lists and trees are all examples of collections each
with a unique set of methods for adding, removing and locating members.
As the concept of a collection is logically independent
of the members of the collection, it follows that a collection is
a suitable subject to be an independent class. For example it would seem quite
wrong to have to reimplement all the machinery of a list, each time a new
type of object needed to be stored in a list.
Technical Note
There are a number of ways to implement container classes. The one
chosen by
root
it to use pointers to a primordial class and require all classes
that are to be held in containers
inherit
from this class so that they can be addressed by
such pointers. Another way to implement containers is to use
templates.
See OO Concepts: Containers
Go Back to the
The Glossary Top Page
If you have any comments about this page please send them to
Nick West