I have been asked to create a chocolate vending machine. So far i have produced a large amount of code, however i am confused as to what is stopping the program from working as there are a large amount of errors being produced.
This is my code so far -
lines 212 and 216 are now the only lines giving me errors, the errors are saying that 'current state' is undefined, however the other lines including current state are working so i am confused on what i have done wrong.
Also, thank you for your help :)
lines 212 and 216 are now the only lines giving me errors, the errors are saying that 'current state' is undefined, however the other lines including current state are working so i am confused on what i have done wrong.
In destructor 'virtual StateContext::~StateContext()': 32:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] At global scope: 56:28: warning: unused parameter 'pin' [-Wunused-parameter] In member function 'virtual bool OutOfChocolate::addChocolate(int)': 98:4: error: 'Chocolate_Dispenser' was not declared in this scope 98:24: error: expected primary-expression before ')' token 98:25: error: expected ')' before 'CurrentContext' 99:70: error: expected primary-expression before ')' token 99:71: error: expected ')' before 'CurrentContext' At global scope: 96:39: warning: unused parameter 'number' [-Wunused-parameter] In member function 'virtual bool NoCredit::insertMoney(int)': 105:4: error: 'Chocolate_Dispenser' was not declared in this scope 105:24: error: expected primary-expression before ')' token 105:25: error: expected ')' before 'CurrentContext' 106:64: error: expected primary-expression before ')' token 106:65: error: expected ')' before 'CurrentContext' At global scope: 103:32: warning: unused parameter 'credit' [-Wunused-parameter] In member function 'virtual bool HasCredit::insertMoney(int)': 113:4: error: 'Chocolate_Dispenser' was not declared in this scope 113:24: error: expected primary-expression before ')' token 113:25: error: expected ')' before 'CurrentContext' 114:64: error: expected primary-expression before ')' token 114:65: error: expected ')' before 'CurrentContext' At global scope: 111:33: warning: unused parameter 'credit' [-Wunused-parameter] In member function 'virtual bool HasCredit::makeSelection(int)': 123:8: error: 'Chocolate_Dispenser' was not declared in this scope 123:28: error: expected primary-expression before ')' token 123:29: error: expected ')' before 'CurrentContext' 129:2: error: expected ')' before 'if' 134:73: warning: suggest braces around empty body in an 'if' statement [-Wempty-body] 136:4: error: 'Chocolate_Dispenser' was not declared in this scope 136:24: error: expected primary-expression before ')' token 136:25: error: expected ')' before 'CurrentContext' 137:24: error: expected primary-expression before ')' token 137:25: error: expected ')' before 'CurrentContext' In member function 'virtual bool HasCredit::moneyRejected()': 146:4: error: 'Chocolate_Dispenser' was not declared in this scope 146:24: error: expected primary-expression before ')' token 146:25: error: expected ')' before 'CurrentContext' In member function 'virtual bool DispensesChocolate::dispense()': 154:30: error: 'Chocolate_Dispenser' was not declared in this scope 154:50: error: expected primary-expression before ')' token 154:51: error: expected ')' before 'CurrentContext' 155:47: error: expected primary-expression before ')' token 155:48: error: expected ')' before 'CurrentContext' 157:28: error: expected primary-expression before ')' token 157:29: error: expected ')' before 'CurrentContext' 157:104: error: expected ')' before ';' token 158:33: error: expected primary-expression before ')' token 158:34: error: expected ')' before 'CurrentContext' 158:99: error: expected ')' before ';' token In member function 'virtual bool Chocolate_Dispenser::dispense()': 212:23: error: 'currentState' was not declared in this scope In member function 'virtual bool Chocolate_Dispenser::enterPin(int)': 216:11: error: 'chocoState' was not declared in this scope 216:22: error: expected primary-expression before ')' token 216:23: error: expected ')' before 'CurrentState' At global scope: 214:40: warning: unused parameter 'pin' [-Wunused-parameter] In member function 'virtual bool Chocolate_Dispenser::dispense()': 213:1: warning: control reaches end of non-void function [-Wreturn-type] In member function 'virtual bool Chocolate_Dispenser::enterPin(int)': 217:1: warning: control reaches end of non-void function [-Wreturn-type]