What is the difference between overloading and overriding?
1 Like
Function overloading is many functions with same name but different number of arguments or different types of arguement in same class. It doesn’t need inheritance of class.
Function overriding is the ability to define same method with same arguments and their types in different classes, it depends on inheritance. To achieve function overriding one class should inherit from other classes which contain same methods.
Function overloading is compile-time polymorphism while function overriding is run time polymorphism.