Foundation Definitions II
Mark Mzyk | February 25, 2008
Picking right up where we left off last time, it’s time for some more definitions based on what Steve Yegge says programmers should know.
1. Static / Class Initializer
A static or class initializer is the block of code called to create a static or class variable. It must be called outside of the class and not in the class constructor because static/class variables are single instance variables that are shared by all instantiations of the class. If each class instantiated the variable, it could be over written by each new instantiation of the class, potentially leading to corruption issues as the classes shared the variable.
2. Constructor
A special method within a class that is automatically called when an object is instantiated. It does not have an explicit return type and is usually responsible for initializing the object’s member variables.
3. Destructor / Finalizer
A special method that is called when an object is destroyed. Its purpose is to free any resources that were used by the object.
4. Superclass / Base Class
A superclass or base class is a class that other classes extend. The classes that extend the superclass gain the functionality of the superclass and can then add their own functionality as well. The superclass is also called a parent class, and the classes that extend it are known as child classes.
5. Subclass / Derived Class
A subclass or derived class is a class that extends another class, gaining that classes functionality while being able to add to it or augment it. This is a child class, while the class it extends is a parent class. Note that it is possible for a class to be both a parent and a child class as the same time.
Part II is now finished, with part III to come in the future.