add(int a, int b);
add(float a, float b);
//function call
add(1,2);
add(1.2,2.3);
The process of redefining the existing data members present in superClass from a base class using inheritance.
superClass{
methodOne() {
cout << "Hi";
}
};
subClass: public superClass{
methodOne(){
cout << "Hello";
}
};
graphTD;
Polymorphism-->CompileTime;
Polymorphism-->Runtime;
CompileTime-->FunctionOverloading ;
CompileTime-->OperatorOverloading;
Runtime-->VirtualFunction;
Runtime-->FunctionOverriding;
#include <iostream>
using namespace std;
class Parent {
public:
void hello(){
cout << "Base Function" << endl;
}
};
class Child : public Parent {
public:
void hello(){
cout << "Derived Function" << endl;
}
};
int main() {
Child he;
he.hello();
return 0;
}