May 2002
Beginner
320 pages
6h 18m
English
A class and an object of a class are not the same thing, any more than blueprints and buildings are the same. A class describes the objects that can be created from it.
You create an object by creating an instance of a class—that is, by defining a variable of the type of the class. This is called instantiation.
The member variables of an object come into existence when the object is instantiated and are automatically destroyed when the object is destroyed.
Objects can be instantiated on the stack or from the heap, like any other variables. An object is destroyed when the program terminates, when it is deleted, or when its variable goes out of scope.
You can see that a class declaration looks just like ...
Read now
Unlock full access