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

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

#include<iostream.h>

#Include<conio.h>

class A

{ int a,b;

public:

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

#include<iostream.h>

#Include<conio.h>

class A

{

public:

virtual void display()=0; };

class B : public A

{ public:

void display()

{ cout<<“show display class”;

}};

void main()

{ A *a1;  B b1;

a1=&b1;

a1–>display();

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.

Shubham

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.

Recent Posts

Top 10 camera apps for android Jo apko download krna cahiye

Top 10 camera apps for android Jo apko download krna cahiye:-  aaj ki ye post hamare un friends ke liye…

1 year ago

Top 5 photo banane wala apps for android mobile downloads

'Top 5 photo banane wala apps for android mobile:- aj kis yeh post un selfie lovers ke liye hai jo…

1 year ago

What is inline Function in C++ in Hindi Language Puri Jankari

What is inline Function in C++ in Hindi Language Puri Jankari:  Programming me function ka main objective memory Program ko small…

1 year ago

What is a database in Hindi Puri Jankari

What is a database in Hindi complete information: Hello friends, today we are going to learn about What is a database in…

1 year ago

What is Inheritance in C++ in Hindi Complete Guide

C++ ka most important feature 'Reusability'  hai. Iske Jariye ham Kisi existing class ko Kai types Se use Kr Sakte…

1 year ago

What Is Friend Function in C++ With Example In Hindi

What Is Friend Function in C++ With Example In Hindi:- Hello Friends Mera Naam Shubham Hai, & I am Back With…

1 year ago