【发布时间】:2017-03-19 06:23:09
【问题描述】:
我正在尝试为某事创建一个类,我需要像在 int 中一样使用 ++ 和 -- 运算符。我有一个错误,它说“预期可重载的二进制运算符”,但我不知道这是什么意思。这是我的代码:
public static int operator ++(TriggerMeter m, int value)
{
if (m != null)
{
int newValue = m.Triggeredness + value;
m.Triggeredness = newValue;
return newValue;
}
return 0;
}
【问题讨论】: