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

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -