title: ERROR : Expression must have class type?
body: <p>I am writing a program for class that manages a Hotel.  This Report1 function is supposed to list all the occupied rooms and which customer is in each room.  I have the code written, but i am getting a error in the condition statement of my nested FOR loop. The compiler is underlining <strong>iRoom</strong> in the loop............ for(int j = 0; j &lt; <strong>iRoom</strong>.customerIDinRoom.....it is saying the iRoom expression must have a class type, but I gave it a class type when I declared it in the first FOR loop(of type Room).  Any suggestioins?</p>
  
  <pre><code>string Hotel::Report1()
  {
  
  string result;
  for(int i=0;i&lt;listofrooms.size();i++)
  {
      Room iRoom = listofrooms.get(i);
      result+= padLeft(intToString(iRoom.roomID),' ',8)+" "+
          padRight(iRoom.name,' ',20) + " "+
          padLeft(intToString(iRoom.floor),' ',8) + " " +
          padLeft(intToString(iRoom.number),' ',8) + " " +
          padLeft(intToString(iRoom.basePriceInSeason),' ',8) + " " +
          padLeft(intToDollarString(iRoom.basePriceOutOfSeason),' ',8) + "\n";
  
      for(int j = 0; j &lt; iRoom.customerIDinRoom.size(); j++)
      {
          int cusID= iRoom.customerIDinRoom[j];
          Customer &amp; cus = listofcustomers.getByID(cusID);
          result+= padLeft(intToString(cus.customerID),' ',18)+" "+
              padRight(cus.name,' ',20) + " "+
              padRight(cus.phoneNumber,' ',10) + " " +
              padRight(cus.ccNumber,' ',20) + "\n";
  
      }
  }
  return result;
  }
  </code></pre>
  
  <p>This is the Room class declaration</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  class Hotel;
  
  class ListOfRooms;
  
  class Room
  {
  friend class ListOfRooms;
  friend class Hotel;
  public:
  Room(string n,int flo,int num,int bpin, int bpos);
  Room();
  void addCusID(int cusID){customerIDinRoom = cusID;}
  void removeCustomerID(int cusID) { customerIDinRoom = 0;}
  
  private:
  string name; //BUILDING
  int floor;
  int number;
  int basePriceInSeason;
  int basePriceOutOfSeason;
  int roomID;
  int customerIDinRoom; //not pushback, will be assignment
  };
  </code></pre>