對不起,可怕的格式,但我只是想知道如果以下將被視爲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