Function Overloading Vs Function Overriding
Function Overloading | Function Overriding |
---|---|
It falls under Compile-Time polymorphism | It can be both Compile Time or Runtime Polymorphism |
A function can be overloaded multiple times as it is resolved at Compile time | A function cannot be overridden multiple times as it is resolved at Run time |
Can be executed without inheritance | Cannot be executed without inheritance |
They are in the same scope | They are of different scopes. |
To know more, you can refer to Function Overloading VS Function Overriding.
Function Overriding in C++
A function is a block of statements that together performs a specific task by taking some input and producing a particular output. Function overriding in C++ is termed as the redefinition of base class function in its derived class with the same signature i.e. return type and parameters. It can be of both type: Compile Time and Runtime Polymorphism.