Currently I have a binary tree template setup where my main is using it with strings to make a question/answer game. I'm using a knowledge base that works as an interface to the binary tree that main uses (main has no access to node or binary tree classes). My code seems to work fine inserting/rearranging nodes as necessary but I think my design is pretty bad.
Is it usually best to just put the Node and BinaryTree classes in the same file since neither is independently useful? Or is it even standard when using binary trees to just make node a nested class inside the tree class?
Not sure how to not use class friending (assuming this is bad design) unless I just do away with the knowledge base. Without knowledge base being able to see private node members it wouldn't be able to move it's "current" node pointer around the tree through questions/guesses unless it passed its current pointer by reference to a binary tree function that moved it each time.
Also with this setup binary tree doesn't really do anything except provide a root node as k base is handling the inserting/rearranging/differentiating between questions and guesses, so I'm not sure how to move some traversal, etc. functionality from kbase to btree without just making a bunch of kbase functions that call their btree counterparts.
Is there a way to use std::swap in each file (node/tree/base) also without polluting with the utility header? This design looks to be bad OO-wise, any help is appreciated.