抱歉,格式很糟糕,但我只是想确定以下内容是否会被视为访问器。
所以我的类定义看起来像这样......
class work {
public:
void getInput(); //Mutator
void output(); //Accessor?
//...
所以这里的功能..
void work::output()
{
dayofweek = day + getMonthvalue(month, year) + ....;
final = dayofweek % 7;
if(final == 0)
cout << "The day of the date is Sunday\n";
else if(final == 1)
cout << "The day of the date is Monday\n";
else if(final == 2)
cout << "The day of the date is Tuesday\n";
/*.
.
.*/
else {
cout << "The day of the day is Saturday\n";
}
}