46 ◾ Software Essentials
void Stack::push(int value)
{ dataP[top] = value;
top++;
}
int Stack::numActive() { return countActive; }
As a type denition, the class construct is similar in other languages.
Typically, data is encapsulated and tagged as private, that is, not directly
accessible outside the class denition. Functionality can be either public
(directly accessible outside the class), or private. ese dierent accessibil-
ity rights allow elements of a class denition to be viewed as private (inter-
nal) or public (external) details.
Since the class construct is a type denition, no memory is allocated
until a variable declaration triggers such an allocation. Object declara-
tions are also known as object instantiations because an ...