我有一个名为的类mc_int,它实际上是一个 int,具有一些特殊能力。它已设置operator int():
mc_int::operator int() {
return value; //int mc_int::value - the real int value of the class
}
但是当我尝试cout<<上课时,我必须始终将课程转换为 int ( cout<<(int)mc_int_instance,因为我收到错误:
多个运算符“<<”匹配这些操作数。
同样,这可能是由于该类还 <<定义了运算符。在这里做什么?