单项选择题
已知类Time的定义如下:
class Time{//时间类
private:
int hour, minute, second; //时、分、秒
public:
Time(int h, int m, int s): hour(h), minute(m), second(s){}
______{
switch(index){
case 0:
return hour;
case 1:
return minute;
default:
return second;
}
}
};
其中横线处应为下标访问运算符[]的重载函数的函数头,横线处应填入的代码是______。
A.int& operator[](Time& t, int index)
B.int& operator[](int index)
C.friend int& operator[](Time& t, int index)
D.friend int& operator[](int index)