Monday, September 20, 2010

Chapter-1: Introduction to object-oriented programming

1) What is an object?
An object is an entity or that has an identity and exhibits some behavior.
From this definition, it is clear that an object has the following three characteristics:
1. Each object should have an identity: An object’s identity is used to identify it uniquely in the world of objects. Two objects may exhibit the same behavior, may or may not have the same state, but never have the same identity.
2. Each object has state: An object’s state is collection of attributes or data that it possesses.
3. Each object exhibits behavior: An object’s behavior is collection of functions that it possesses. Each function, in turn, is used to specify the operation the object performs. Usually, an object’s behavior refers to the changes that occur to its attributes over a period of time.