Retrieving Objects in Collections
We have defined the major task of collection classes as storing and retrieving objects. How you retrieve or find an object depends on its properties. Every object you create has three properties associated with it:
1. Type: for example, an RWCString or a double. In C++, the type of an object is set at creation, and cannot change.
2. State: the value of the string. The values of all the instance variables or attributes of an object determine its state. These can change.
3. Identity: the unique definition of the object for all time. Languages use different methods for establishing an object's identity. C++ always uses the object's address. Each object is associated with one and only one address. Note that the reverse is not always true, because of inheritance. Generally, an address and a type are both necessary to disambiguate the object you mean within an inheritance hierarchy. Because of multiple inheritance, it may be necessary to know not only an object's type, but also its location within an inheritance tree in order to disambiguate which object you mean.