如何先执行 tryout.main() cout,然后打印 main() 函数 cout,最后打印 tryout.main() 的返回值。这有点令人困惑。谁能解释一下?
#include<iostream>
using namespace std;
class TryOut
{
public:
int main()
{
std::cout<<"In TryOut Main Function "<<std::endl;
return 0;
}
};
int main(int argc, char **argv)
{
TryOut tryout;
std::cout<<"In Main function: "<<tryout.main()<<std::endl;
return 0;
}
输出:
In TryOut Main Function
In Main function: 0