What Is Polymorphism in oops | Compile & runtime polymorphism Example

What is a polymorphism in oops – Did you Want to Know What is Compile & runtime polymorphism With the real-time example in Hindi Then You Are Right Place.

Hello, Friends, I am Back with another post of C++ & Today’s Topic is What Is Polymorphism in oops With Examples in Hindi.

Polymorphism C++ Ka ek Concept Hai, Jiska Meaning Hota Hai.

One object can be used in many from. 

Polymorphism oops ki Ek Aisi Technique Hai, Jo Ek Single Operator or function ke Thought more then one task perform karane ki facility provide karati Hai.

Types Of Polymorphism in Object-Oriented Programming

What Is Polymorphism in oops
Types Of Polymorphism in oops

Aap log is Diagram ko Dekh kar samajh gaye hoge Ki C++ Me Polymorphism Ko 2 Bhago Me Bata Jaa Sakta Hai.

  1. Compile Time Polymorphism (Early Binding)
  2. Run Time Polymorphism (Late Binding)

What Is Binding In Polymorphism?

Jab Function Object Ke Sath link kiya jaata Hai, tab Usse Binding Kahte Hai. OOPS (Object Oriented Programming System) Me Jab bhi kisi function ka use Kiya jaata Hai, Tab Wah function Call hone Se Pahle Object Se Link Ho Jata Hai.

What Is Early (Compile Time Polymorphism) Binding?

Early Binding ka Concept Overloading Dwara apply Kiya Jata Hai, Is Binding Me Compiler Ko information Compile time me Hi Ho Jati hai, Aur Compile time per Hi appropriate Work select kar leta hai.

Isiliye Ise Compile Time Polymorphism, Early Binding, Static linking Bhi Kahte hai.

Early Binding Ka simply Means Hota Hai ki Kisi Bhi Work Ko Compile Time Per hi Bound Kr Dena, Early Binding Me Function Execution Speed Increase Ho Jati Hai Aur Yeh program ko Efficiently provide karate hai.

Compile Time Polymorphism Example



class A

{ int a,b;


void show()                                              

{ cout<<a<<“\t”<<b;

}  void show (int x, int y)                             

{ a=x; b=y; cout<<a<<“\t”<<b;

} void show(int c)

{a=c; b=10; cout<<a<<“\t”<<b;


void main() {

A a1;

a1.show();   a1.show(100);   a1.show(500,300);

getch();   }

Is program me 3 Show Ke Function Bane Huye Hai, Jiske Work Alag-Alag Hai. hamne Class A Ka ek Object Ke Jariye Teno function Ko Call Kiya Hai.

Iss Prakar ke Polymorphism Me me Compiler Argument Ke Hisaab Se Function Run Krta hai. Ager Hamne function Ko Call krte Time 2 Argument Provide Krwaya hai To Green Wala Function Run Hoga.

Also Read: What is Inheritance in C++ in Hindi Complete Guide

Also Read: What is Constructor in C++ in Hindi with an example

What Is Late (Runtime Polymorphism) Binding?

Late Binding me koi Bhi Work Run Time Me Bound Ho Jaata Hai, Isme Program Execution Speed Slow ho Jati Hai But Iska Main Benefit Yeh Hai Ki Yeh Program Ko flexibility Provide karwata Hai.

Runtime Polymorphism Example



class A



virtual void display()=0; };

class B : public A

{ public: 

void display() 

{ cout<<“show display class”;


void main()

{ A *a1;  B b1;



getch(); }

Is program Me Pointer Aur Virtual function ka Use kiya gaya hai, Sabse Pahle A aur B ke Object(a1,b1) Create Kiya Gaya hai. Fir a1 ko b1 ka address access krke a1 pointer se display function ko run karwaya gaya hai. Iss concept me Max Pointer Ka use Hua Hai (Pointer To Object).

Main Sure hu Ki Apko Yeh Post What Is Polymorphism in oops | Compile & runtime polymorphism Example Jarur Pasand Aayi Hogi, Ager Isse Related Koi Question ho To aap Comment Karke Puch Sakte Hai, Post Achaa Lage To Share Karna Naa Bhule.

Hello Friends, I'm Shubham Gupta. Eduinhindi Ka founder, I just want to learn new things consistently that is why I created this blog. If you like my post share with your friends on the social media platform.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.