Classes and objects are the heart of object-oriented programming. This topic shows how to describe a kind of thing as a class, create objects from it, give the class constructors, release resources, and overload methods.
Key words in this topic
- Class: a blueprint that describes the attributes and methods of a kind of object.
- Object (instance): one real thing built from a class, with its own attribute values.
- Attribute (field) and method: what an object knows, and what it can do.
- Constructor: special code that runs when an object is created, to give it its starting values.
- Reference: a variable that holds the location of an object, not the object itself.
- Overloading: several methods with the same name but different parameter lists.