So i have this 3 functions:
void bookings(const std::string name, const Date& date)const;
void bookings(const std::string name)const;
void bookings(const Date& date)const;
I want to use them in 3 different ways. First, if i pass the name and the date to use the first function. Second if i pass only the name to use the second function and if i pass only the date to use the third function. I am using the console to pass the arguments. Is there any way to do that? I write this :
std::string event, name;
int d, m, y;
std::cout << "event: ";
std::getline(std::cin, event);
std::cout << "date: ";
std::cin >> d >> m >> y;
if (event == "")
{
bookings(Date(d, m, y));
}
else if (d > 0 && m>0 && y>0)
{
bookings(event, Date(d, m, y));
}
else
{
bookings(event);
}
but in the case when i don't pass the date doesn't work. I know it is something with the arguments of the date and that in this case they aren't defined. Is there any way to fix this?