以下内容有效,但当我执行该(*this)(5)部分时感觉很丑。
(*this)(5)
struct MyStruct { void operator()(int a) { // Do something with "a" } void myFunc() { (*this)(5); } };
我需要重载该()运算符并在其他类方法中使用它。
()
c++ oop overloading
c++ ×1
oop ×1
overloading ×1