fork download
  1. #include <iostream>
  2. using namespace std;
  3. class A
  4. {
  5. public:
  6. int operator [](int b)
  7. {
  8. return 1;
  9. }
  10. };
  11. int main()
  12. {
  13. A a;
  14. cout << a[1] << endl;
  15. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
1