Overloading vs. overriding.- Overriding of functions occurs when one class is inherited from another class. Overloading can occur without inheritance.
- Overloaded functions must differ in function signature ie either number of parameters or type of parameters should differ. In overriding, function signatures must be same.
- Overridden functions are in different scopes; whereas overloaded functions are in same scope.
- Overriding is needed when derived class function has to do some added or different job than the base class function.
- Overloading is used to have same name functions which behave differently depending upon parameters passed to them.