C Theroux wrote: |
---|
1. mo, dy, and yr are initialized in the class declaration and set by the constructor |
No, they're not.
month,
day, and
year are assigned values in the constructor.
mo,
dy, and
yr are not. Notice that the constructor parameters named
mo,
dy, and
yr do not refer to those declared in the class definition and hide their names. Each instance of your
Date class has 7 int variables. Only 3 of those are given values in the constructor. The variables are declared at lines 15-17 and lines 20-23.
C Theroux wrote: |
---|
2. displayDate is the name of the function. |
displayDate is the name of a member function of
Date (a method.) See line 40. Note how
displayDate is declared inside the definition of
Date. Furthermore, when you defined
displayDate (line 46) you used the
Date:: scope qualifier which indicated you were defining a member function of
Date.
My suggestion to you is to change the prototype of displayDate to:
void displayDate() const;
where it's declared in the class defintion.
and change the definition to
1 2 3 4
|
void Date::displayDate() const
{
// code to display date using month, day and year.
}
|
And completely remove lines 20-23.
C Theroux wrote: |
---|
3. and my compiler throws a fit everytime i try to remove the void from line 74 in order to MAKE it a call.... i get this error when i remove the void: |
Just removing
void isn't enough.
If you made the changes above the call becomes simply:
now.displayDate();