Pregunta de entrevista de Tata Consultancy Services

What is the difference between function overloading and function overriding ?

Respuesta de la entrevista

Anónimo

11 de sept de 2016

The interviewer wanted to know where to use which(by an example), so I started with function overloading giving an example of sum function to add two numbers. I told him that we can have more than one sum function for different types of input data i.e. for integers and float type data we can use function overloading. Then I came to function overriding, As soon as I started to answer that it is used in case of inheritance the interviewer stopped me and gave me remarks on my answer on his sheet(on the table).