Tuesday, December 7, 2010

Object

An Object of a given class is called an instance of the class. The instance is the actual object created at runtime. Object belonging to a class will have same attributes and actions as the class. Here Attributes are the characteristics that describes an object.

When we look at the real world we see all objects share two characteristics, state and behavior.
Like a man will have different
States : Name, Skin tone, Hungry .... etc
Behaviors: Eating, Talking, Relaxing, walking .... etc

Take a self test, look at objects around you in your surrounding and decide what states and behaviors these objects posses. Identifying things like this is actually thinking in terms of Object Oriented Programming (OOP).

Software Objects are also similar to real world objects they also posses states and behaviors. States are stored in Fields and behaviors are exposed through Methods (also known as functions in some programming languages).

No comments:

Post a Comment