未命名 3

Posted on 2013-11-18 09:55  Flex/AS Programmer  阅读(88)  评论(0编辑  收藏  举报

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;

}

}

}


这两种写法的区别是什么?

Copyright © 2024 Flex/AS Programmer
Powered by .NET 8.0 on Kubernetes