作为一名 C++ 程序员,我最近开始使用 Visual C++。我被属性卡住了。
这个想法是创建一个内部类,该类将具有 2 个方法以及诸如 get/set 函数之类的属性。在视觉 C++ 中是否有可能(我猜是的)。
用法是这样的:
Foo ^ foo = gcnew Foo();
int a;
foo->Method(); // here some function is called
a = foo; // here the property like get() function is called.
我什至尝试过使用运算符重载来做到这一点,但它似乎在视觉 c++ 中比在“普通”c++ 中复杂得多。
乔丹