Tuesday, January 14, 2014

What is Object?


What is Object?
·         An Instance of a Class.

·         Think of an object as a fancy variable.

·         It stores data, but you can “make requests” to that object, asking it to perform operations on itself.

·         To make a request of an object, you “send a message” to that object.

·         An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behavior. For example, the hand can grip something or a Student (object) can give the name or address.

·         Real-world objects share two characteristics: They all have state and behavior. Dogs have state (name, color, breed and hungry) and behavior (barking, fetching, wagging tail). Bicycles also have state (current gear, current pedal cadence, and current speed) and behavior (changing gear, changing pedal cadence, applying brakes). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.


·         In order to clearly understand the object orientation, let’s take your “hand” as an example. The “hand” is a class. Your body has two objects of type hand, named left hand and right hand. Their main functions are controlled/ managed by a set of electrical signals sent through your shoulders (through an interface). So the shoulder is an interface which your body uses to interact with your hands. The hand is a well architected class. The hand is being re-used to create the left hand and the right hand by slightly changing the properties of it.



No comments:

Post a Comment