3 ms·
> explains that leaving out overloading is "simpler", meaning _simpler for them_. This also means your program code is simpler, and therefore, faster. Functio
by cbhl 13y ago
> explains that leaving out overloading is "simpler", meaning _simpler for them_.
This also means your program code is simpler, and therefore, faster.
Function overloading usually means virtual method tables, and therefore indirect method calls. Depending on how deep your inheritance / overloading structure is, these vtables can get really messy.
(I had a class in university where we were given a C++ UML class diagram, and told to draw the vtables that resulted when one instance of a subclass was instantiated.)
- n1ghtm4n 13y agoFunction overloading can be accomplished by name mangling at compile time. PROGRAMMER SEES INTERNAL REPRESENTATION foo(int a, char b) foo_int_char foo(int x) foo_int
- lysium 13y agoHe did not mean overriding (methods in derived classes), but overloading (functions with the same name). You can resolve the latter at compile time, no indirection needed. For example you can have two overloaded functions println() and println(String).