- 1

What is the difference between function overloading and function overriding ? Explain.

25th Apr 2018, 11:52 AM
shubham
2 Answers
+ 2
Override: In hierarchy context happen when you redefine a inherited method without change his signature (return type and arguments) Overload: This happen when you define a function/method with differents arguments (count or/and types) using a yet defined name in visible scope
25th Apr 2018, 12:19 PM
KrOW
KrOW - avatar
+ 1
Old answer to a similar question: https://www.sololearn.com/discuss/1212251/?ref=app And overloading implements the same function name with different behaviour depending on the passed parameters. int foo(int a){ return a+5; } float foo(float a){ return a+0.5; } It uses the implementation which fits your passed arguments. foo(5) will run the int version foo(0.5) will run the float version
25th Apr 2018, 12:17 PM
Alex
Alex - avatar