fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class MyClass
  5. {
  6. public:
  7. void operator[](int n)
  8. {
  9. cout<<"In [], index = " << n;
  10. }
  11. };
  12. int main()
  13. {
  14. MyClass *a=new MyClass;
  15. a->operator[](2);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
In [], index = 2