Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualbluepig.man

Posted 16 December 2012 - 09:54 AM

Your example doesn't make sense. "Being in a class" and "being global" is not mutually exclusive and neither of these are directly connected to performance.
So, please clarify where the conflict is and why might be able to help!


l'm sorry,the description about problem is blurry.
the code is like this:
[source lang="cpp"]extern vector<string> pacman_map;class pacman_game{ pacman hero;public: pacman_game(const int &px,const int &py);};class pacman{ friend pacman_game; move();public: pacman();};[/source]
pacman::move and pacman_game will use pacman_map,so l put it on global scope. But l am worry about that problem.
from grammatical speaking,the map should be put in the class,it's a part of the pacman_game.(the pacman_game is designed as game system class)
However,for convenience and performance(if the map is put in the pacman_game,l should pass the map into hero member),put the map on global scope may the common way.

#2bluepig.man

Posted 16 December 2012 - 08:56 AM

l'm sorry,the description about problem is blurry.
the code is like this:
[source lang="cpp"]extern vector<string> pacman_map;class pacman_game{ pacman hero;public: pacman_game(const int &px,const int &py);};class pacman{ friend pacman_game; move();public: pacman();};[/source]
pacman::move and pacman_game will use pacman_map,so l put it on global scope. But l am worry about that problem.
from grammatical speaking,the map should be put in the class,it's a part of the pacman_game.(the pacman_game is designed as game system class)
However,for convenience and performance(if the map is put in the pacman_game,l should pass the map into hero member),put the map on global scope may the common way.

#1bluepig.man

Posted 16 December 2012 - 08:49 AM

l'm sorry,the description about problem is blurry.
the code is like this:
[source lang="cpp"]extern vector<string> pacman_map;class pacman_game{ pacman hero;public: pacman_game(const int &px,const int &py);};class pacman{ friend pacman_game; move();public: pacman();};[/source]
pacman::move and pacman_game will use pacman_map,so l put it on global scope. But l am worry about that problem.

PARTNERS