Virtual Function hash()
The function hash() should return an appropriate hashing value for the object. Here is the function's declaration:
 
unsigned hash() const;
A possible definition of hash() for our class Bus might be:
 
unsigned Bus::hash() const{
return (unsigned)busNumber_;
}
The example above simply returns the bus number as a hash value. Alternatively, we could choose the driver's name as a hash value:
 
unsigned Bus::hash() const{
return driver_.hash();
}
In the above example, driver_ is an RWCString that already has a hash function defined.
NOTE: We expect that two objects that test true for isEqual will hash to the same value.