【发布时间】:2012-06-17 10:13:46
【问题描述】:
试图将我的二叉搜索树 (BST) 的根传递给 UI 函数(我需要将其作为可修改变量传递,或者无论如何调用它)
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
header 中的 UI 类有:
private:
void handle (int, Matrix, BST<Matrix *>);
在 .cpp 文件中:
void ui::handle(int cmd, Matrix matrix, BST<Matrix *> data)
我知道我在某个地方搞砸了,但我不能说在哪里,我对指针的把握很差
我得到的错误:它认为BST<Matrix>&*,而函数要求BST<Matrix> *
我目前不打算过多使用 C++,因此不需要详细的回答(尽管表示赞赏)。
【问题讨论】:
标签: c++ pointers parameter-passing