Yes, but overloads cannot differ by return type alone. The signatures must differ by the number and/or the type of the arguments.
Chat with our AI personalities
In C there are functions only, In Java methodsonly (static methods as well), in C++ both.
1. In C language, you cannot compile a source-file if it has two (or more) functions with the same name. 2. You cannot link a program if it has two (or more) global (ie: non-static) functions with the same name.
Inline functions can be static. However, their usage outside of classes in C++ has been deprecated (a hangover from C). Static member functions are allowed of course, and they can be inline expanded where desired. In C, a static function simply has limited scope within the same translation unit. In C++, unnamed namespaces are the preferred method of achieving the same end.
Of course they are used. Both stand-alone and class-member functions are used in C++.
Yes you can overload the static method. But it should be avoided because memory to static methods are allocated at the time of class load.....so memory will be wasted if we don't use that methods. Whereas non-static method memory allocation depends on Object