![]() |
|
|||||||||||||||||
Object (computer science)An object is a data structure that is unique and separate from other objects, although they are able to interact with other objects. An object is the central concept in object-oriented programming, and the term object today usually refers to an object in the OOP sense. In OOP, an object consists of two kinds of members:
In the case of most objects, one can access the data members only through the method members, making it easy to guarantee that the data will always remain in a well-defined state (class invariants will be enforced). Some languages do not make distinctions between data members and methods. A real-world example of an object would be "my dog", which is an instance of a type (a class) called "dog", which is a subclass of a class "animal". In the case of a polymorphic object, some details of its type can be selectively ignored, for example a "dog" object could be used by a function looking for an "animal". So could a "cat", because it too belongs to the class of "animal". While being accessed as an "animal", some member attributes of a "dog" or "cat" would remain unavailable, such as the "tail" attribute, because not all animals have tails. Three properties characterize objects:
Some terms for specialized kinds of objects include:
See also
The contents of this article are licensed from Wikipedia.org under the GNU Free Documentation License.
How to see transparent copy 01-04-2007 01:21:04 |
|





