////////////////////////////////////////////////////////////// // Data.H // // CMSC 341 - Fall 2001 Project 2 // // kyu bae xxx-xx-5868, Section 201 // // kyu_bae@yahoo.com / kbae1@umbc.edu // // Created : 20 September 2001 // // Current : 30 September 2001 // ////////////////////////////////////////////////////////////// #ifndef _DATA_H #define _DATA_H #include ////////////////////////////////////////////////////////////// // Class: // // Data class stores the character and integer pairs // // read from the file. This class will allow to access // // the data members and print the _letter data member. // // It has a print idiom and output operator to print // // its data member // // Author : Kyu Bae // // Version : 28 September 2001 // ////////////////////////////////////////////////////////////// class Data { public: ////////////////////////////////////////////////////// // Data(): // Default constructor. Initialize the data members // to zero. /////////////////////////////////////////////////////// Data(); ////////////////////////////////////////////////////// // Data(): // Constructor with two arguments.Initiaalizes // _letter to letter and _key to key. // Param letter : char type is assigmed to _letter // Param key : int type is assigned to _key /////////////////////////////////////////////////////// Data(char letter, int key); ////////////////////////////////////////////////////// // ~Data(): // Destructor is automatically called by computer /////////////////////////////////////////////////////// ~Data(); ////////////////////////////////////////////////////// // getLetter(): // accessor to get the _letter // Return : char type _letter /////////////////////////////////////////////////////// char getLetter(void) const; ////////////////////////////////////////////////////// // getKey(): // accessor to get the _key // Return : int type _key is return /////////////////////////////////////////////////////// int getKey(void) const; /////////////////////////////////////////////////////// // printLetter(): // accessor to print the _letter when Data object is // called to print. // Param out : ostream type obejct is passed to print // _letter. /////////////////////////////////////////////////////// void printLetter(ostream & out) const; /////////////////////////////////////////////////////// // operator!= (): // not equal operator checking if the data member // is same. // Param data : object of Data is passed to check // Return : boolean is return if same or not. /////////////////////////////////////////////////////// bool operator != (const Data &data) const; private: char _letter; //char letter int _key; //integer num }; ///////////////////////////////////////////////////////////// // operator<<(): // output operator to print the object of Data. It // will print the _letter only. // Param out: ostream object is passed in // Param data: Object of Data to call printLetter() // Return: Ostream object is passed to printLetter() ///////////////////////////////////////////////////////////// ostream & operator << (ostream & out, const Data &data); #endif