3条回答 默认 最新
threenewbee 2016-04-12 23:49关注可以啊
#include <iostream> using namespace std; class A { public: int operator [](int b) { return 1; } }; int main() { A a; cout << a[1] << endl; }解决 无用评论 打赏 举报
可以啊
#include <iostream>
using namespace std;
class A
{
public:
int operator [](int b)
{
return 1;
}
};
int main()
{
A a;
cout << a[1] << endl;
}