Lesson 6 | Multiple objects |
Objective | Describe the Difference between an Object and a Class |
Describe the Difference between an Object and a Class
At any one time, there may be many different instances of one class. Then again, there may be only one or even no instances of the class.
Use the SlideShow below to see an example:
- Here are two different Point objects. There is still only one Point class though.
- The state of an object is the combination of the values of the attributes of the object.
- In general, an object's state is allowed to change during its lifetime.
Multiple Objects of Class
Several Instances
If there are several instances of a class, that is, several objects, changes that affect one object do not affect the others.
Their attributes remain unchanged. For example, if Jo Smith, the example customer from the previous lesson, pays outstanding fees to reduce the account balance to zero, this does not pay off all the balances of all the other customers in the store. Their attributes are unaffected.
Objects Classes - Quiz