C++ Overloading Conversion Operators

前端 未结 4 1325
暗喜
暗喜 2021-02-16 00:11

I am trying to have a class that allows implicit casting to certain built in types, like unsigned long int and since I\'m trying to do this as correct as possible (this is my fi

4条回答
  •  一个人的身影
    2021-02-16 00:43

    You just need to copy the same function prototype into the implementation. ie.

    CustomizedInt::operator unsigned long int() const
    

提交回复
热议问题