Redirected from Class in object-oriented programming
A class specifies the data items each object of the class contains and the operations or methods that can be performed on each object belonging to the class (in object-oriented languages that lack generic functions).
(Some languages have objects but no classes. In these languages, objects are not restricted to structure provided by classes, and can be changed at will. This less common technique is called object-based programming.)
Classes are often related in some way. The most popular of these relations is inheritance, which involves subclasses and superclasses, also known respectively as child classes (or derived classes) and parent classes (or base classes). If [cars] was a class, then [Jaguar] and [Porsche] might be two sub-classes. If [Button] is a subclass of [Control], then all buttons are controls.
Some programming languages (for example C++) allow multiple inheritance - they allow a child class to have more than one parent class. This technique has been criticized by some for its unnecessary complexity and being hard to implement efficiently, though some projects have undoubtedly benefited from its use. Java, for example has no multiple inheritance, its designers feeling that this would be more trouble than it was worth.
Because the Microsoft Windows API was originally designed in an object-oriented way, each window is an instance of a class called the "window class".
Sub- and superclasses are considered to exist within a hierarchy.
See also: hierarchy, object-oriented programming, abstract class
For related meanings of the word "class", see Class. For other uses of the word class within computer science, see Class (computer science)
Search Encyclopedia
|
Featured Article
|