What is the need Polymorphism in OOP?
<p>I have Silly Question on OOPs concept, what is reason we go for polymorphism??</p>

<p>Simple code in C++:</p>

<pre><code>class Shape{
public:
virtual void draw(){ cout&lt;&lt;"Shape"&lt;&lt;endl;};
};

class Traingle: public Shape
{
public: void draw(){cout&lt;&lt;"Triangle"&lt;&lt;endl;}
};

class Rectangle: public Shape
{
public: void draw (){cout&lt;&lt;"Rectangle"&lt;&lt;endl;}
};

int main(){
Shape *ptr= new Traingle();
ptr-&gt;draw();
delete ptr;
return 7;
}
</code></pre>

<p>Here ptr->draw() function will call the Triangle draw, if pointed to Rectangle then Rectangle draw, which is late binding.</p>

<p>What is necessity of creating Base class pointer and point it to different classes? We can create separate class object without any virtual function and call whicever needed. 
like</p>

<pre><code>int main(){
    Traingle tObj; 
    tObj-&gt;draw();
    Rectangle rObj; 
    rObj-&gt;draw();
}
</code></pre>

<p>which basically does the same thing; </p>

<p>Why polymorphism basically? why virtual?</p>

<p>What is the need of it or what difference does it make using this property? 
And real case example would help!!</p>