Header File (.h):
bool canTravelWith(const Passenger&) const;
Implementation File (.cpp):
bool Passenger::canTravelWith(const Passenger& x) const
{
bool canTravel = false;
//if both passengers have the same destination on the same date...
if (strcmp(x.m_destination,this->m_destination) == 0 && x.m_year == this->m_year && x.m_month == this->m_month && x.m_day == this->m_day)
{
canTravel = true;
}
return canTravel;
}
Hey guys,
The code above works but what I wanted to know is if the parameter's object's members are privately accessed; how am I able to call that object's members inside my canTravelWith()?
In any other cases; I wouldn't be able to call an object's private members.
I want to understand why that is.
Thanks. (: