Polymorphism Part 1 C++
Polymorphism: Poly means many and morph means forms. So polymorphism means having many forms. Implementation: Polymorphism can be implemented by: Function overriding Operator overloading Virtual function Polymorphism implementation by Function overriding: What is function overriding? Function overriding is a feature that allows us to have the same function in child class which is already present in the base class. As we know that a child class inherits the data members and functions of the base class, but when we want to override a functionality of a function of base class in child class we can use function overriding. For example: Consider you make a base class named Person then you make a function of the class Person named Profession. As every child class of Person class that you make will have different profession. #include<iostream> using namespace std; class Person{ public: void profession(){ //base class ...