OO codes are dynamic with
being created and destroyed as required by the task in hand. Objects
require memory to hold their
For objects created dynamically there are two sources:-
Objects, and other variables, that are declared within any
are created on the stack. When execution leaves the compound statement, the
is called and the stack memory space reclaimed. So stack-based objects are
useful for short term work, but if an object has to exist beyond the end of
statement, then they must be created on the heap using the new operator.
- The stack - for short-lived objects
- The heap - for permanent objects.
See OO Concepts:Constructors & Destructors
See First Steps Lesson: Stack & Heap Objects
Go Back to the
The Glossary Top Page
If you have any comments about this page please send them to