HeroVO* hero=NULL;
if (_upgradeProxy->heroId!=-1) {
for (map<int, HeroVO>::iterator iter=_heroProxy->heroMap.begin(); iter!=_heroProxy->heroMap.end(); ++iter){
HeroVO* heroVO=&(iter->second);/注意这行
if (heroVO->id==_upgradeProxy->heroId) {
hero=heroVO;
break;
}
}
}
HeroVO* hero=NULL;
if (_upgradeProxy->heroId!=-1) {
for (map<int, HeroVO>::iterator iter=_heroProxy->heroMap.begin(); iter!=_heroProxy->heroMap.end(); ++iter){
HeroVO heroVO=iter->second;//注意这行
if (heroVO->id==_upgradeProxy->heroId) {
hero=&heroVO;
break;
}
}
}
这两种写法的区别是什么?