Module 7. Overloading Operators Exercises

1.  Write the member function to overload the == operator.  Use the
standard == operator to compare the weightDate data member of the
ZooAnimal object to the integer parameter.

   class ZooAnimal  
   {
    private:
      char *name;
      int cageNumber;
      int weightDate;
      int weight;
    public:
      ...
      int operator== (int);
      ...
   };


2.  Write the member function to overload the auto-decrement operator.
Use the standard -= operator to decrease the ZooAnimal object's weight
by 1 (pound).

   class ZooAnimal  
   {
    private:
      char *name;
      int cageNumber;
      int weightDate;
      int weight;
    public:
      ...
      void operator-- ();
      ...
   };


3.  Write the member function to overload the function call operator.
Give the parameter the value of the data member cageNumber.

   class ZooAnimal  
   {
    private:
      char *name;
      int cageNumber;
      int weightDate;
      int weight;
    public:
      ...
      void operator() (int&);
      ...
   };

   // ========== an application to use the ZooAnimal class
   void main ()
   {
    ZooAnimal bozo ("Bozo", 408, 1027, 400);
    int cage;

    bozo(cage);
    cout << cage << endl;
   }