作者maboroshiga (幻)
站内C_and_CPP
标题[问题] 呼叫别的.cpp档内的函数
时间Sat Aug 29 04:50:37 2009
我有一个写好的类别 在 CExpense.h 及 CExpense.cpp内 如
class CExpense : public CBase
{
public :
void ConstructL();
~CExpense();
....
}
如果我要在另一个.cpp档内 呼叫这个 ConstructL() 如
CExpense.ConstructL();
compile时会发生错误:
expected primary-expression before '->' token
用
CExpense::ConstructL(); 也会错误:
cannot call member function `void CExpenseDb::ConstructL()' without object
请问哪里写错了 还是遗漏了什麽 thakns~
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.204.20.126
1F:推 QQ29:你完全使用错误了 08/29 04:57
2F:→ QQ29:你要用 要用object去呼叫 CExpense obj;obj.ConstructL(); 08/29 04:58
3F:→ QQ29:你要用CExpense::ConstructL();你要宣告成static void Con... 08/29 04:58
4F:→ QQ29:你错误讯息也写得很明确了 08/29 04:59