OBJECT


                     PREVIOUS                                                                                                          NEXT

Basically an object is anything that is identifiable as a single material item. You can see around and find many objects like Camera, Monitor, and Laptop etc. In OOP perspective, an object is nothing but an instance of a class that contains real values instead of variables.

Definition (Object) An object is an instance of a class. It can be uniquely identified by its name and it defines a state which is represented by the values of its attributes at a particular time.

The state of the object changes according to the methods which are applied to it. We refer to this possible sequence of state changes as the behaviour of the object.

Definition (Behaviour) The behaviour of an object is defined by the set of methods which can be applied on it.

A class provides the blueprints for objects, so basically an object is created from a class. We declare objects of a class with exactly the same sort of declaration that we declare variables of basic types. Following statements declare two objects of class Box:-

Box Box1;          	// Declare Box1 of type Box
Box Box2;         	// Declare Box2 of type Box

In above example box is class and box1 and box2 are objects of class box. Both of the objects Box1 and Box2 will have their own copy of data members.







Powered by Blog - Widget
Face Upward - Widget