✅ Definition:

Polymorphism ka matlab hota hai — "many forms"

Ek hi function ya operator different kaam karein different context mein.

🗣️ “Ek naam, multiple kaam”


🧠 Real-Life Example:

Real World Polymorphism Concept
Tumhara mobile ka volume button:

🔑 Types of Polymorphism in C++:

Type Also Called As When It Happens
✅ Compile-time Polymorphism Static Binding During compilation
✅ Run-time Polymorphism Dynamic Binding During execution

🟦 1. Compile-time Polymorphism

➡️ Achieved by:


🔷 A. Function Overloading

Same function name, different parameters

cpp
CopyEdit
#include<iostream>
using namespace std;

class Print {
  public:
    void show(int a) {
        cout << "Int: " << a << endl;
    }

    void show(string s) {
        cout << "String: " << s << endl;
    }
};

int main() {
    Print p;
    p.show(5);        // Int: 5
    p.show("Nikhil"); // String: Nikhil
}