- State
- Behavior
State is also can be refereed to as a property. A dog has properties like color, breed, name and height. By looking at the object you can identify these properties. A dog has behaviors such as running, eating, barking and sleeping. Behaviors are things that dog can do (perform). Therefore behaviors are also can be defined as actions that a particular object can do.
Another example, think about the light bulb. Light bulb has properties such as color, on and off. Also it has behaviors such as turn-off and turn-on.
Objects we find in a software are also similar to objects in real world. They also have states and behaviors. The state of an object is represented by fields (sometimes fields are refereed to variables). Behaviors of an object are represented by methods. Methods are the key fundamental item which perform action in a software.
0 comments:
Post a Comment