c++ - index operator constness -
Why do we need two? In what situation the following operator [] is called?
class X {public: // ... int and operator [] (int index); Const int and operator [] (int index) const; };
fu (x) {x [0]; // The non-construction indexer is called the bar (constant x) {x [0]; // const constant is called}
Comments
Post a Comment