///////////////////////////////////////////////////////////////////////////////// // Perishable.H // // CMSC341 Fall 2001 -Project 1 // // Kyu Bae 212-04-5868 Section 201 // // kyu_bae@yahoo.com /kbae1@umbc.edu // // created: 1 September 2001 // // current: 10 September 2001 // ///////////////////////////////////////////////////////////////////////////////// #ifndef _PERISHABLEGOODS_H #define _PERISHABLEGOODS_H #include "string.H" //////////////////////////////////////////////////////////////////////////////// // class PerishableGoods: // vector object with 3 data types, type, color, weight. assigns to another // PerishableGoods. compare for equality of same PerishableGoods. // Author: kyu bae // Version: 10 september 2001 //////////////////////////////////////////////////////////////////////////////// class PerishableGoods { public: /////////////////////////////////////////////////////////////////////////// // Default constructor: // assign type, color and weight to zero. // no arguement are passed /////////////////////////////////////////////////////////////////////////// PerishableGoods(); //////////////////////////////////////////////////////////////////////////// // constructor with three arguements: assigns type to _type, color to _color // weight to _weight // Param type: type of string class to write to _type // Param color: color of string class tow write to _color // Param weight: weight int type to write to _weight //////////////////////////////////////////////////////////////////////////// PerishableGoods(string type, string color, int weight); //////////////////////////////////////////////////////////////////////////// // Copy constructor: // Param rhs: rhs to copy /////////////////////////////////////////////////////////////////////////// PerishableGoods(const PerishableGoods & rhs); /////////////////////////////////////////////////////////////////////////// // Destructor: /////////////////////////////////////////////////////////////////////////// ~PerishableGoods(); /////////////////////////////////////////////////////////////////////////// // Assignment operator: // assign pg to this PerishableGoods // Param pg: pg is the PerishableGoods to assign the rvalue // Return: this PerishableGoods after modification /////////////////////////////////////////////////////////////////////////// const PerishableGoods & operator= (const PerishableGoods & pg); /////////////////////////////////////////////////////////////////////////// // Equal operator: // comapre if PerishableGoods p1 is equal // Param p1: p1 is the PerishableGoods to compare the perishableGoods // Return: boolean if they are same or not. /////////////////////////////////////////////////////////////////////////// bool operator == (const PerishableGoods & p1) const; /////////////////////////////////////////////////////////////////////////// // print your PerishableGoods data members // Param out: out the stream to write data members /////////////////////////////////////////////////////////////////////////// void print (ostream &out) const; private: string _type; string _color; int _weight; }; //////////////////////////////////////////////////////////////////////////////// // Output operator: // Param out: out the stream to which to write rPer // Param rPer: rPer is the PerishableGoods object to write // Return: ostream //////////////////////////////////////////////////////////////////////////////// ostream & operator << (ostream &out, const PerishableGoods &rPer); #endif