Astha Jain
Difference between overloading and overriding ?
By Astha Jain in C, C++, MFC on May 25 2012
  • amritesh srivastava
    Jul, 2012 31

    Overloading means when we use same function name for different argument number or types.It is useful to achieve polymorphism. Overriding means when we reimplement a function of a super class in a sub class so that inside the sub class only new definition is used.It is used to implement inheritance and reusability.

    • 2
  • Premkumar Selvarajan
    Sep, 2012 28

    OverLoading: 1.It is evaluated at compiletime. 2.Within a same class only we can overload a method 3. No keyword is necessary. Overriding: 1.it is evaluated at runtime 2.within a class cant do overriding.Can override the superclass virtual method from subclass method with same method name 3.need override and virtual keyword

    • 1
  • rahul jaiswal
    Aug, 2012 24

    Method overriding is when a child class redefines the same method as a parent class, with the same parameters. For example, the standard Java class java.util.LinkedHashSet extends java.util.HashSet. The method add() is overridden in LinkedHashSet. If you have a variable that is of type HashSet, and you call its add() method, it will call the appropriate implementation of add(), based on whether it is a HashSet or a LinkedHashSet. This is called polymorphism. Method overloading is defining several methods in the same class, that accept different numbers and types of parameters. In this case, the actual method called is decided at compile-time, based on the number and types of arguments. For instance, the method System.out.println() is overloaded, so that you can pass ints as well as Strings, and it will call a different version of the method.

    • 1
  • Akkiraju Ivaturi
    Aug, 2012 23

    Overloading is a compile time binding and overriding is a runtime or late binding.

    • 1

Most Popular Job Functions


MOST LIKED QUESTIONS