Trying to pass the root of my Binary Search Tree (BST) to the UI function (I need to pass it as a modifiable variable or however it’s called)
main.cpp
cmd = UI.uiCmd()
BST<Matrix> *data = new BST<Matrix>;
Matrix mat;
UI.handle (cmd, mat, data); // passing command, class object, root of BST
The UI class in the header has:
private:
void handle (int, Matrix, BST<Matrix *>);
and in the .cpp file:
void ui::handle(int cmd, Matrix matrix, BST<Matrix *> data)
I know I’m messing up somewhere but I can’t say where, I have a very poor grasp of pointers
The error I get: it thinks BST<Matrix>&* while function asks BST<Matrix> *
I don’t plan on using C++ much for now, so a detailed answer (while appreciated) is not necessary.
Your function signature should look like
instead of