Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CustomerRegister::removeCustomer(const string customerNumber, const string name)
- {
- Customer *c = new Customer(name,customerNumber);
- int pos = this->customerExist(*c);
- if (pos == -1) {
- delete c;
- throw "Customer don't exist in register...";
- return false;
- }
- // adds the last customer to the pos. should I delete it too?
- delete this->customers[pos];
- this->customers[pos] = nullptr;
- this->customers[pos] = this->customers[this->nrOfCustomers - 1];
- this->nrOfCustomers--;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement