Your constructor declares a local array of size "size" called wordList. It will not initialize the data member of DictHash called wordList. I would assume that you use std::map for the type of wordList. In that case, it should work without initialization. Otherwise, you need to use an std::vector for wordList, and initialize it as follows:
//constructor
DictHash::DictHash(int size) : wordList(size)
{
}
What is after the : is called the initialization list, and it is basically where you call all the constructors of all (or some of) the data members of the class, with whatever parameter they need.
mike_2000_17
Posting Virtuoso
2,134 posts since Jul 2010
Reputation Points: 1,634
Solved Threads: 457