By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,188 Members | 832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,188 IT Pros & Developers. It's quick & easy.

function overloading in c++ how can we overload main?

P: 2
function overloading in c++ how can we overload main?
Sep 12 '10 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,916
You can't. Not only can't you but I can think of no reason why you would want to.
Sep 12 '10 #2

Expert Mod 5K+
P: 9,197
Your program needs an entry point function. The loader will jump to that function so start the program.

The default function is main().

However, you can have an entry point function other than main. All you need to do is tell the linker the name of the function so the address of that function is loaded as the entry point to start the program.

You can do this in the linker portion of the makefile, or with an IDE like Visual Studio, you set an entry point property to the correct function.

This is not really an overload but is a sneaky way to have a program with no main().
Sep 16 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.