So I am a java programmer and I know what overloading a function means. Moreover, I have overloaded a function with different type of arguments, and can overload with, fewer and greater arguments.
I was asked this on an interview. I really don’t know if this has any benefits or what the interviewer was getting at here. Does it have any performance advantages? Any thoughts?
Thanks.
It is about providing a flexible interface by allowing the functions to be called with default values. Some languages allow this via optional parameters, but you can achieve more or less the same with overloads.