title: C++ undeclared identifier on lines 16, 17, and 18
body: <p>I am trying to call the Triangle method however I don't seem to be doing it correctly in the main. on line 16 i have 3 errors:</p>
  <blockquote>
  <p>Triangle: undeclared identifier, syntax error missing ';' before
  identifier 'newTriangle' and newTriangle undeclared identifier</p>
  </blockquote>
  <p>On line 17 it says newTriangle undeclared identifier, and line 18 newTriangle undeclared identifier.</p>
  <p>I'm not sure what I'm doing wrong or what I'm leaving out.</p>
  <p><strong>My Code:</strong></p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  
  using namespace std;
  
  //Base Class (Abstract/Interface)
  class Interface{
  
  public:
      virtual int area() = 0;
      virtual int perimeter() = 0;
  };
  
  int main() {
      Triangle newTriangle;
       newTriangle.area();
       newTriangle.perimeter();
  };
  
  //Triangle
  class Triangle : public Interface {
      int s1 = 3;
      int s2 = 5;
  
  public:
      int area() {
          double a = ((s1 * s2) * 1 / 2);
          cout &lt;&lt; &quot;The area of the triangle:&quot;;
          cout &lt;&lt; a &lt;&lt; endl;
      }
      int perimeter() {
          double b = (s1 + s2 + s2);
          cout &lt;&lt; &quot;The perimeter of the triangle is: &quot;;
          cout &lt;&lt; b &lt;&lt; endl;
      }
  };
  </code></pre>