对不起,可怕的格式,但我只是想知道如果以下将被视为Accessor。这会被视为Accessor吗? (C++)
所以我的类定义看起来是这样的......
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";
}
}
通常,*存取器*返回正在*存取*的数据。 – 2014-12-11 02:40:55
通常,* mutator *会更改数据成员的值。 – 5gon12eder 2014-12-11 02:43:29
我会同时打电话给他们两个 – 2014-12-11 02:45:30