title: benefits of interface c++?
body: <p>look at this code </p>
  
  <pre><code>#include&lt;iostream&gt;
  
  using namespace std;
  
      //Shape is an Interface Class. No data and everything pure virtual
      class Shape {
      public:
        virtual void Area(int length, int breadth) = 0;
        virtual void Perimeter(int length, int breadth) = 0;
        //Note, no data
      };
  
      //Derived class - Inherits Shape as Public
      class Rectangle : public Shape {
      public:
        void Area(int length, int breadth);
        void Perimeter(int length, int breadth);
      private:
        int someData;
      };
  
      //Derived class - Inherits Shape as Public
      class Triangle : public Shape {
      public:
        void Area(int length, int breadth);
        void Perimeter(int length, int breadth);
      private:
        int someData;
      };
  
      int main()
      {
        Rectangle r;
        Triangle t;
  
        cout&lt;&lt;"\n\n";
        r.Area(3,4);
        r.Perimeter(3,4);
  
        t.Area(3,4);
        t.Perimeter(3,4);
  
        cout&lt;&lt;"\n\n";
        return 0;
      }
  
      void Rectangle::Area(int length, int breadth)
      {
        cout&lt;&lt;"\nThe Area of Rectangle for length = "&lt;&lt;length&lt;&lt;" and\
        breadth = "&lt;&lt;breadth&lt;&lt;" is "&lt;&lt;(length * breadth)&lt;&lt;endl;
      }
  
      void Rectangle::Perimeter(int length, int breadth)
      {
        cout&lt;&lt;"\nThe Perimeter of Rectangle for length = "&lt;&lt;length&lt;&lt;" and\
        breadth = "&lt;&lt;breadth&lt;&lt;" is "&lt;&lt;2 * (length + breadth)&lt;&lt;endl;
      }
  
      void Triangle::Area(int length, int breadth)
      {
        cout&lt;&lt;"\nThe Area of Triangle for length = "&lt;&lt;length&lt;&lt;" and\
        breadth = "&lt;&lt;breadth&lt;&lt;" is "&lt;&lt;(length * breadth)/2&lt;&lt;endl;
      }
  
      void Triangle::Perimeter(int length, int breadth)
      {
        cout&lt;&lt;"\nThe Perimeter of Triangle for length = "&lt;&lt;length&lt;&lt;" and\
        breadth = "&lt;&lt;breadth&lt;&lt;" is "&lt;&lt;(length * breadth)/3&lt;&lt;endl;
      }
  </code></pre>
  
  <p>I use interface in the code , but my question is what i should use it and what is the benefits from it , no performance , no real needed it , why i should i use it ( the interfaces ) . what is the point to use it , an you explain it please .</p>
  
  <p>and thank you !</p>