title: Why does this const member function allow a member variable to be modified?
body: <pre><code>class String
  {
  
      private:
          char* rep;
  
      public:
          String (const char*);
          void toUpper() const;
  };
  
  
  String :: String (const char* s)
  {
      rep = new char [strlen(s)+1];
      strcpy (rep, s);
  }
  
  
  void String :: toUpper () const
  {
      for (int i = 0; rep [i]; i++)
      rep[i] = toupper(rep[i]);
  }
  
  
  int main ()
  {
      const String lower ("lower");
      lower.toUpper();
  
      cout &lt;&lt; lower &lt;&lt; endl;
      return 0;
  }
  </code></pre>