Glossary: Constructor
Objects
are complete, miniature programs and, like any good programs, have
well defined initialisation and termination phases. They have special routines
(i.e. member functions )
to look after this. The initialisation routine is called the constructor, and
C++ ensures that every object, however ephemeral, is properly initialised by
calling its constructor. The designer of the object can have more than one
constructor, a situation called
overloading
and then the compiler will select between them
depending on exactly what arguments are passed to the constructor function.
However there must always be a default constructor, to be used when no
information is supplied.
The termination routine is called the
destructor
See OO Concepts: Constructors & Destructors
Go Back to the
The Glossary Top Page
If you have any comments about this page please send them to
Nick West