title: `int size() const` or `const int size()`
body: <p>I am working on an implementation of a simple <code>Vector</code> class that forms a container for a constant sized double array (following the example on page 51 of <a href="http://www.stroustrup.com/Tour.html" rel="nofollow noreferrer">A Tour of C++</a>). My issue is with the method <code>int size() const</code>. It feels odd to define it this way, instead of <code>const int size()</code>. Both seem to work. Does anyone know the difference, if there is any? </p>
  
  <p>Below is the class declaration and the definition of <code>Vector::size()</code>.</p>
  
  <pre><code>class Vector{
  
  public:
      Vector(int);
      Vector(std::initializer_list&lt;double&gt;);
      ~Vector(){delete[] elem;}
      double&amp; operator[](int);
      int size() const;
  
  private:
      int sz;
      double* elem;
  };
  
  int Vector::size() const{
      return sz;
  }
  </code></pre>
  
  <p><strong>Note:</strong> I found similar posts (<a href="https://stackoverflow.com/questions/35723575/class-method-signature-with-const-or-without-const">1</a>,<a href="https://stackoverflow.com/questions/1143262/what-is-the-difference-between-const-int-const-int-const-and-int-const">2</a>), but they do not answer my question.</p>