我有以下类:
class risc { // singleton
protected:
static unsigned long registers[8];
public:
unsigned long operator [](int i)
{
return registers[i];
}
};
你可以看到我已经实现了中括号运算符用于“获取”操作。
现在我想要实现它用于“设置”,即:risc[1] = 2
。
如何实现呢?