Start of Tutorial > Start of Trail > Start of Lesson | Search |
The class body contains all of the code that provides for the life cycle of the objects created from it: constructors for initializing new objects, declarations for the variables that provide the state of the class and its objects, methods to implement the behavior of the class and its objects, and in rare cases, afinalize
method to provide for cleaning up an object after it has done its job.Variables and methods collectively are called members.
Note: Constructors are not methods. Nor are they members.The
Stack
class defines one member variable in its body to contain its elements--theitems
Vector
. It also defines one constructor--a no-argument constructor--and three methods:push
,pop
, andisEmpty
.
Start of Tutorial > Start of Trail > Start of Lesson | Search |