I can not figure out why this won’t work. When I run it I get all kinds of undeclared identifier errors on my object c1 and customer. If i do a Customer* c1 = new Customer(); I still get the same errors and it will not let me setcustomerID. its probably something stupid, Any input would be awesome.
void checkout(){
srand(time(NULL));
int random = rand() % 3 + 1;
Customer c1;
c1.setcustomerID("0");
}
class Customer{
public:
string customerID;
string list;
public:
Customer(){}
~Customer(){}
string getcustomerID(){
return customerID;
}
string getList(){
return list;
}
void setcustomerID(string x){
customerID = x;
}
void setList(int x){
if(x==1)
list = "bread";
if(x==2)
list = "eggs";
if(x==3)
list = "cheese";
}
};
You should put:
before your checkout() method