-2
類
我有錯誤我窩時的結構的類獲取誤差爲嵌套結構中
此內部頭文件
class chord
{
public:
struct Node
{
void del(string, chord&);
void insert(string, chord&);
};
map<int, Node>& getNodeList(); # line 44
}
這是錯誤消息:
44|error: candidate is: std::map<int, chord::Node>& chord::getNodeList()|
這是.ccp文件
map<int, Node>& chord::getNodeList() # line 34
{
return Node_List;
}
當我嘗試編譯我收到以下錯誤
main.cpp|34|error: 'Node' was not declared in this scope
main.cpp|34|error: template argument 2 is invalid|
main.cpp|34|error: template argument 4 is invalid|
main.cpp|34|error: prototype for 'int& chord::getNodeList()' does not match any in class 'chord'|
當我更改爲以下類型,我得到這個錯誤
|35|error: invalid use of non-static data member 'chord::node'|
|44|error: from this location|
class chord
{
public:
struct Node
{
void del(string, chord&);
void insert(string, chord&);
}node;
map<int, node>& getNodeList();
}
謝謝你的幫助是定義
將'Node_List'類型的成員添加到您的'chord'類並使用該對象進行操作,而不是像現在這樣操作的類型 –
請閱讀http://stackoverflow.com/help/mcve並根據需要更新您的問題。 –