Jump to content

Class (computer programming)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Taw (talk | contribs) at 00:04, 9 December 2001 (splitted away from Class article, relations between classes). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

A class is a description of a collection of objects with the same internal structure. 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. An object belonging to a class is also called an instance of the class.


Classes are often related in some way. The most popular of these relations is inheritance, that is, all objects of one class, called child class or subclass, belong not only to this class, but also to other class, called parent class or superclass. For example all class Button (some specific kind of widget) may be subclass of class Widget (anything that can be displayed by windowing system), so all buttons are, by definition, widgets.

This technique is often used to add some abstraction.


Some programming languages allow multiple inheritance - they allow a child class to have more than one parent class. This technique is much less useful and it often criticized for its unnecessary complexity and being hard to implement efficiently.


See also: Object-oriented programming


For other meaning of word class, see Class.