Newbie here needs some help, I have to use this header file as is, i can not modify it. I have only worked on 3 functions and i am having problems....please help
Code:
// header file
class Date
{
public:
Date(int m = MM, int d = DD, int y = YY, const char *name = NA);
void setDate(int m, int d, int y, const char *name = NA);
~Date(); //destructor
void print() const; //display data
void cinDate(); //cin the date
private:
int theMonth;
int theDay;
int theYear;
char *theName;
void setString(const char *str); //utility function
};
// implementation
Date::Date(int m, int d, int y, const char *name)
{ setDate(m, d, y, const char *name); }
void Date::setDate(int m, int d, int y, const char *name)
{
theMonth = (m >= 1 && m <= 12) ? m : MM;
theDay = (d >= 1 && d <= 31) ? d : DD;
theYear = (y >= 0 && y <= MAX_YY) ? y : YY;
setString(const char *str);
}
void Date::print() const
{
cout << "theMonth" << " theDay" << "," << " theYear" << endl;
}
the void setdate function is suppose to validate parameters and sets all data components. If parameters are out of range, defaults will be used. The function setString() to set up theName.
Date.....The constructor has four args. Its also default constructor. The function calls setDate() to init the components. (did i call the function right?)
I get these four errors
error C2059: syntax error : 'const'
: error C2143: syntax error : missing ')' before 'const'
: error C2660: 'setString' : function does not take 0 parameters
: error C2059: syntax error : ')'