What is Polymorphism in C++ ?

No comments


Polymorphism :- It allows a single name/operator  to be associated with different operations depending on the type of data passed to it. In C++ it is achieved by function overlapping, operator overlapping and dynamic binding. 


Example :-  int sum (int a, int b) {return (a+b);}
                      float sum (float a, float b){ return (a+b);}

The observe two functions used to add two integers and two float. The function will be called depending on the arguments passed to it.

No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀