To Call an Object Outside of Class
Hi...I'm new here. I'm also a beginning Computer Science student, C++ OOP. I have mostly successfully put together a program which contains two objects, firstDate and secondDate. This program accepts two dates, increments the dates by one week, and correctly identifies whether the incremented date is a leap year, what day of the week it is, and what month it is. I am stuck on one little step, however, and that is in trying to get the program to identify which of the two objects converted values are largest in a function definition. If anyone is willing to help me with how to call these values in the function listed below, it would be much appreciated.
First, I have defined the bool function in my header file, outside of the class:
Code:
bool isLarger(int, int);
Second, I have in my definition file this function definition(which doesn't function), also outside of the class and is the last one in the file:
Code:
bool isLarger(int, int)
{
if (firstDate.convert() > secondDate.convert())
{
cout << "The first date entered is the most recent. " << endl << endl;
return true;
}
else
{
cout << "The second date entered is the most recent. " << endl << endl;
return false;
}
}
Third, I have no idea how to call it in my application file, my main() function. Would it be something like:
Code:
CDate.isLarger(firstDate.convert, secondDate.convert);
I'm sure I'm just missing something totally obvious, but I appreciate the help. Let me know if I need to attach the entire file(s).
Many thanks