0

I'm writing a dayType class program and I'm having trouble with comparing two different days to each other. Here is what I have for them:

bool dayType::equalDay(const dayType& otherday) const
{

}

and here is main:

if (day.equalDay(newday))
   cout << " equal days" << endl;
else
    cout << "not equal days" << endl;

at this moment day and newday are both set to 29, so cout << " equal days" << endl; should be run, but I'm having a hard time figuring out how to write the statement to compare these two.

I would really appreciate and help offered.

Thanks for the help.

Sincerely yours;

jdm

Edited by Dani: Formatting fixed

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by jdm
0
bool dayType::equalDay(const dayType& otherday) const
{
    return (this->day == otherday.day);
}

"this" is the object with which you are calling equalDay().
You are comparing this's day and otherdays's day and returning the result.

0

Thank you for the help.

It worked perfectly.

jdm

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.