Can We Overload Main Function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Can We Overload Main Function

In C, C++& Java

20th Jun 2017, 2:16 PM
Sanjay Bisht
Sanjay Bisht - avatar
2 Answers
+ 11
For C++, it is not possible. - 3.6.1p2 An implementation shall not predefine the main function. This function shall not be overloaded. For Java, it is possible, but with exceptions. https://stackoverflow.com/questions/3759315/can-we-overload-the-main-method-in-java For C, no form of overloading is supported apart from original built-in functions, e.g. printf()
20th Jun 2017, 2:32 PM
Hatsy Rei
Hatsy Rei - avatar
20th Jun 2017, 4:06 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar