title: rogue like game initializing error
body: <p>I'm making a simple map for simple rogue-like game.
  So I need to initialize map with Objects created for each array cell by receiving data from character array[i][j].
  Suggested that such CWall, CDoor classes are defined in other files like CWall.cpp, CWall.h, Underneath are the code to initialize in map.cpp</p>
  
  <p>But is this right way to code?
  I think this causes a problem of allocating memory.</p>
  
  <pre><code>CObject CMap::insertObject(char character){ 
      if (character = '*') {
          CWall cwall;
          return cwall;
      }
  
      if (character = 'D') {
          CDoor cdoor;
          return cdoor;
      }
  
      if (character = 'F') {
          CFood cfood;
          return cfood;
      }
  
      if (character = 'K') {
          CKey ckey;
          return ckey;
      }
  
      if (character = 'M') {
          CMMonster cmmonster;
          return cmmonster;
      }
  
      if (character = 'm') {
          CMonster cmonster;
          return cmonster;
      }
  
      if (character = '@') {
          CPlayer cplayer;
          return cplayer;
      }
  
      if (character = 'P') {
          CPrincess cprincess;
          return cprincess;
      }
  
      if (character = '&amp;') {
          CRock crock;
          return crock;
      }
  
      if (character = 'S') {
          CShield cshield
          return cshield;
      }
  
      else {
          CShield cshield;
          return cshield;
      }
  }
  
  void CMap::initialize(char arr[][COLS]){
      for (int i = 0; i &lt;= 11; i++){
          for (int j = 0; j &lt;= 38; j++){
              char character = arr[i][j];
              insertObject(character);
          }
      }
  }
  </code></pre>