title: Object oriented design for hotel reservation system
body: <p>I am practicing object oriented design for an upcoming interview. My question is about the design for a hotel reservation system:
  - The system should be able to return an open room of a specific type or return all the open rooms in the hotel.
  - There are many types of rooms in hotel like regular, luxury, celebrity and so on.</p>
  
  <p>So far I have come up with following classes:</p>
  
  <pre><code>Class Room{
  //Information about room
  virtual string getSpecifications(Room *room){};
  }
  
  Class regularRoom: public Room{
  //get specifications for regular room
  }
  
  Class luxuryRoom: public Room{
  //get specifications for regular room
  }
  //Similarly create as many specialized rooms as you want
  
  Class hotel{
  vector&lt;Room *&gt;openRooms; //These are all the open rooms (type casted to Room type pointer)
  
  Public:
  Room search(Room *aRoom){ //Search room of a specific type
          for(int i=0;i&lt;openRooms.size();i++){
              if(typeid(*aRoom)==typeid(*openRooms[i])) return *openRooms[i];
          }
  }
  
  vector&lt;Room&gt; allOpenRooms(){//Return all open rooms
  ...
  }
  
  }
  </code></pre>
  
  <p>I am confused about the implementation of hotel.search() method where I am checking the type (which I believe should be handled by polymorphism in some way). Is there a better way of designing this system so that the search and allOpenRooms methods can be implemented without explicitly checking the type of the objects?</p>