我们可以在 C++ 程序中有两个 main()
函数吗?
最佳答案
标准在 3.6.1 中明确表示:
A program shall contain a global function called main, which is the designated start of the program. [...] This function shall not be overloaded.
所以在一个程序的全局范围内只能有一个main
函数。其他作用域中也称为 main
的函数不受此影响,它们可以有任意数量。
关于c++ - 两个主要功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2626533/