// Word.h
// class Word creates a word object.  Each word has all
// the functions that a program may want to perform on 
// a word.  For instance, comparing the equality of two
// words is made possible with overloading operator ==.
// Some of these functions utilizes operations from class
// string.  class string is provided with in the standard
// library.

#include <iostream.h>
#include <string.h>

const int WORD_LENGTH = 20;

class Word
{
private:
	char aWord[WORD_LENGTH];
protected:
	// checks if index in Range
	int inRange( int i );
public:
	// constructor
	Word( char s[] = "" );	

	// returns the length of a word
	int length(); 	

	// allows indexing of a word
	char& operator[] ( int index ); 

	// prints a word
	void print( ostream & out ); 

	// reads a word
	void read( istream & in ); 

	// compares the equality of two words
	friend bool operator == ( Word w1, Word w2 ); 

	// overloading operator << to print a word
	friend ostream & operator << ( ostream & out, Word w );

	// overloading operator >> to read in a word
	friend istream & operator >> ( istream & in, Word w );
};

