title: Why can't a class have same name for a function and a data member?
body: <p>Why can't a c++ class have same name for a function and a  data member?</p>
  
  <pre><code>class demo{
      public:
          int size();
      private:
          int size;   
  };
  
  int main(){
      return 0;
  }
  
  
  C:\Users\S&gt;g++ demo.c
  demo.c:5:7: error: declaration of 'int demo::size'
  demo.c:3:7: error: conflicts with previous declaration 'int demo::size()'
  </code></pre>