我收到一個我不明白的錯誤。我相信這很簡單..但我仍然在學習C++。 我不確定它是否與我的參數與純虛擬函數聲明完全相同或者是否與其他內容相關。沒有匹配的函數調用未解析的重載函數類型
這裏是我的簡化代碼:
in header_A.h
class HandlerType
{
public:
virtual void Rxmsg(same parameters) = 0; //pure virtual
};
--------------------------------------------------
in header_B.h
class mine : public HandlerType
{
public:
virtual void myinit();
void Rxmsg(same parameters); // here I have the same parameter list
//except I have to fully qualify the types since I'm not in the same namespace
};
--------------------------------------------------
in header_C.h
class localnode
{
public:
virtual bool RegisterHandler(int n, HandlerType & handler);
};
--------------------------------------------------
in B.cpp
using mine;
void mine::myinit()
{
RegisterHandler(123, Rxmsg); //this is where I am getting the error
}
void Rxmsg(same parameters)
{
do something;
}
爲什麼你認爲'Rxmsg'可以用在需要HandlerType的地方? – 2015-02-24 05:40:07
什麼是HandlerType? – Jagannath 2015-02-24 05:42:20
'localnode :: RegisterHandler(123,'Rxmsg);可以在沒有對象的類中調用? – 2015-02-24 05:43:12