I am trying to compile a code that utilises an array of 5 'hotel' objects as below:
#include "Hotel.h"
using namespace std;
int main()
{
Hotel *hotels = new Hotel[5];
hotels[0] = new Hotel("Hershey");
hotels[1] = new Hotel("Milton");
hotels[2] = new Hotel("Sheraton");
hotels[3] = new Hotel("BestWestern");
hotels[4] = new Hotel("DaysInn");
for(int i = 0; i < 5; i++)
hotels[i].print();
return 0;
}
Hotel.h:
#ifndef HOTEL_H
#define HOTEL_H
#include "DLList.h"
#include <string>
using namespace std;
class Hotel
{
private:
char *name;
DLList<char *> *guestList;
int guestCount;
public:
Hotel();
Hotel(char *n);
~Hotel();
char * getName(){return name;}
DLList<char *> * getGuestList(){return guestList;}
void checkIn(char *guestName);
bool checkOut(char *guestName);
int count(){return guestCount;}
void print();
};
#endif
My problem is that on compilation I get the following:
Error 1 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Hotel *' (or there is no acceptable conversion) ...\app.cpp 11
Error 2 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Hotel *' (or there is no acceptable conversion) ...\app.cpp 12
Error 3 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Hotel *' (or there is no acceptable conversion) ...\app.cpp 13
Error 4 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Hotel *' (or there is no acceptable conversion) ...\app.cpp 14
Error 5 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Hotel *' (or there is no acceptable conversion) ...\app.cpp 15
any suggestions?
I have inlcuded all the code i have on it. Sorry, haven't commented it but is simple enough for any one with intermediate knowledge of c++ to figure out, my appologies in advance :p