I can't seem to get this right.
class Tree
{
Node* root;
vector& dict;
}
class Node
{
vector& dict;
char* cargo;
Node left;
Node right;
}
I want each instance of Tree to have it's own dict, and I want it to pass a reference to the dict to the node constructor, which would recursively pass the reference to each child node so that each Node can enter a pointer to itself in the dict.
I'm having a lot of trouble with the syntax to:
- get the vector initialized
- pass a reference to the vector to the Node constructor
- receive the reference in the Node constructor
I know this stuff is pretty basic. I'm teaching myself c++.
Thanks