void foo ( int arg1, int arg2)
foo(1)
foo(1,2)
how do i know whether the int arg2 is using the optional function parameter that was passed like in the second foo call or the default one was used like in the 1st foo?
Update:
public:
header file
// Point 1
void fireworkShipment(stack<Firework*>&);
void sellFireworks(stack<Firework*>&, int quantity);
// Point 2
void metalShipment(stack<Metal>&);
~FireworkFactory();
// Point 3 for correctness, Point 4 for O(1) runtime
void sellFireworks(stack<Firework*>&, int quantity, Color color);
void sellFireworks(stack<Firework*>&, int quantity); //error here
cpp file:
void FireworkFactory::sellFireworks(stack<Firework*>& customerStack, int quantity, Color color){
// TODO
cout<< "which color: " << color << "\n";
for (int i = 0; i< fireworkstorage.size(); i++) {
if (fireworkstorage.front()->getColor() == color && quantity != 0) {
customerStack.push(fireworkstorage.front());
cout<< "Color: " <<fireworkstorage.front()->getColor() << "\n";
fireworkstorage.pop();
quantity--;
cout<< "Quantity: " <<quantity << "\n";
} else {
fireworkstorage.push(fireworkstorage.front());
fireworkstorage.pop();
}
}
}
void FireworkFactory::sellFireworks(stack<Firework*>& customerStack, int quantity){
for (int i = 0; i<quantity; i++) {
customerStack.push(fireworkstorage.front());
fireworkstorage.pop();
}
}