#ifndef _WORDLIST_H #define _WORDLIST_H #include // for access to cin, cout, insert, and extract. #include // to be able to use the string class #include "apvector.h" // to be able to use the vector class class wordList{ public: // default constructor wordList (); // constructor that is told the number of elements // the constructed wordList object needs to have wordList (unsigned int numberOfElements); // The copy constructor for the wordList class wordList (const wordList & right); // function to search for a certain word. Returns // true if word is found; false otherwise. Also returns // position of thw found word or position of where // the word ought to go if inserted bool search(const string & myWord, int & position) const; // function that overloads the operator +=. This changes // the receiver by adding to it a word bool insert(const string & right); // function that overloads the = operator. This function // copies the wordList object on the right hand side // of = into the wordList object on the left hand side of = void operator = (const wordList & right); // function that overloads the [ ] operator for the wordList // class. This provides easy access to the elements of a wordList // object. string operator [ ](unsigned int index) const; // function that returns the number of words stored in a // wordList object unsigned int numberWords() const; private: unsigned int actualSize; // The number of slots of the Vector actually // occupied with words apvector < string > list; // The list of words }; // Function that overloads the insert operator so that wordList objects // can be conveniently inserted into the output stream ostream & operator << (ostream & out, const wordList & right); #endif /* _WORDLIST_H is not defined */