CPOI and CWaypoint

CPOI and CWaypoint

本文关键字:CWaypoint and CPOI      更新时间:2023-10-16

我已经为像这样的+=运算符使用了运算符重载

CRoute& CRoute::operator+=(string name ){
CWaypoint *p=this->m_pWpDatabase->getPointerToWp(name);
if(p!=NULL){
this->addWaypoint(name);
}
else{
cout<<" Waypoint not found in DB "<<endl;
}
return *this;
}

现在我想做同样的操作+=将poi添加到我的路由中,我正在使用语法C路由&运算符+=(字符串namepoi);

但是我得到的错误消息是‘CRoute&CRoute::operator+=(std::string)'不能重载有人能帮忙吗??

建议的运算符重载函数的函数签名与当前存在的函数签名冲突。那么,如果您想为poi创建运算符重载,为什么不能传递poi object而不是它的名称呢?