title: C++ request for member ‘’ in ‘’, which is of non-class type ‘’
body: <p>I have written a simple C++ program which is as follows-</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  class Rectangle
  {
      double length, breadth;
  
  public:
      Rectangle(void);        // constructor overloading
      Rectangle(double, double);  // constructor of class
      // void set_values(double l, double b);
      double area(void);
  };  // can provide an object name here
  
  
  // default constructor of class 'Rectangle'-
  Rectangle::Rectangle(void)
  {
      length = 5;
      breadth = 5;
  }
  
  
  // constructor of class 'Rectangle'-
  Rectangle::Rectangle(double l, double b)
  {
      length = l;
      breadth = b;
  }
  
  
  /*
  void Rectangle::set_values(double l, double b)
  {
      length = l;
      breadth = b;
  }
  */
  
  
  double Rectangle::area(void)
  {
      return length * breadth;
  }
  
  
  int main()
  {
      /*
      Rectangle r;
      r.set_values(12, 3.4);
      */
  
      Rectangle r(12, 3.4);
      Rectangle s();
  
      cout&lt;&lt;"Area = "&lt;&lt;r.area()&lt;&lt;endl;
      cout&lt;&lt;"Area = "&lt;&lt;s.area()&lt;&lt;endl;
  
  
  return 0;
  }
  </code></pre>
  
  <p>When I try to compile it, I get the following error-</p>
  
  <pre><code>Classes_Example.cpp: In function ‘int main()’:
  Classes_Example.cpp:61:21: error: request for member ‘area’ in ‘s’, which is of non-class type ‘Rectangle()’
    cout&lt;&lt;"Area = "&lt;&lt;s.area()&lt;&lt;endl;
  </code></pre>
  
  <p>I am using g++ (GCC) 7.2.0</p>
  
  <p>Thanks!</p>