所以我有一个错误,我将它定位到这个函数。似乎没有其他问题。
完整的错误行:
word_driver.obj : 错误 LNK2001: 无法解析的外部符号“public: class WORD & __thiscall WORD::operator=(class std::basic_string,class std::allocator > const &)” (??4WORD@@QAEAAV0@ABV?$ basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
WORD us;
us = "abc";
cout<<"Testing operator= by assignment the value of \"abc\" to use\n";
cout<<us;
class WORD
{
public:
WORD & operator=(const string &);
WORD & operator=(const WORD &);
private:
void AddChar(char);
alpha_numeric *front;
};
WORD & WORD::operator=(const WORD & org)
{
alpha_numeric *p;
if (this != &org)
{
if (!Is_Empty())
{
while(front != 0)
{
p = front;
front = front->next;
delete p;
}
}
for(p = org.front; p!=0; p=p->next)
{
AddChar(p->symbol);
}
}
return *this;
}