0
出于某种原因,我的赋值操作符产生总线错误,当我尝试使用它:重载赋值运算符总线错误
hand1 = hand2;
//overload assignment operator
Hand Hand::operator=(Hand other_hand)
{
if(&other_hand != this){
name = other_hand.name;
cards = other_hand.cards;
}
return *this;
}
return语句之后
你正在服用并返回副本,你可能不想这样做。 – 2013-03-03 01:39:39
复制交换!复制交换! – chris 2013-03-03 01:44:01
另外,你能告诉我们一个手的定义吗?目前还不清楚是否有名字或卡片有需要管理的内存,即你是否在删除析构函数中加倍删除内容? – 2013-03-04 01:57:59