If we look at the node constructor:
Node(string s)
{
word = s;
occurences = 1;
right = left = NULL;
} //Node's constructor initialises node's values
Example of a bad comment above!
But if we look at what is actually happening here. The member word is default constructed, then in the body you are calling the assignment operator to update word with the value of s. Effectively your code is equivalent to:
Node(string s)
: word() // Note word is defaulted constructed here.
{
word = s; // Now we call the assignment operator.
// STUFF
}
The better way to do it is using the initializer list:
Node(string s)
: occurences(1)
, word(s)
, right(nullptr)
, left(nullptr)
, height(0)
{}