Advertisement
Guest User

works

a guest
Sep 11th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1.  
  2.  
  3. #include <cstdlib>
  4. #include <iostream>
  5. #include <vector>
  6. using namespace std;
  7.  
  8. class A
  9. {
  10. public:
  11.  
  12.     A() : _bla(4)
  13.     {
  14.  
  15.     }
  16.  
  17.     const int& operator()(int num1, int num2) const
  18.     {
  19.         return _bla[num1 + num2];
  20.     }
  21.  
  22.     int & operator()(int num1, int num2)
  23.     {
  24.         return _bla[num1 + num2];
  25.     }
  26. private:
  27.     vector<int> _bla;
  28. };
  29.  
  30. int main(int argc, char** argv)
  31. {
  32.     A a;
  33.     cout << a(1, 1) << endl;
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement