Object class and instance

The concept of classes

A class is the structure of an object, meaning the definition of all items that an object is made up of. An object is therefore the "result" of a class. In reality, an object is an instance of a class, which is why can use interchange the terms object or instance (or even occurrence).

A class is made up of two parts:

  • Attributes (often called member data): this is the data that refers to the object's state
  • Methods (often referred to as member functions): these are functions that can be applied to objects

If we have a class called car, the objects Peugeot 406 and Renault 18 will be instances of this class. There may also be other objects Peugeot 406, differentiated by their model number. Furthermore: two instances of a class may have the same attributes but may be considered separate distinct objects. In a real world scenario: two T-shirts may be identical, but they are however distinct from each other. However, if we mix them together it is impossible to distinguish one from the other.



Last update on Thursday October 16, 2008 02:43:13 PM


This document entitled « Object class and instance » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the licence, as this note appears clearly.