这些天,在poco c++中阅读代码,发现类中定义了main函数;第一次看到这样的用法,但没有查到这样写的意义和目的,难道像java那样写,自己写了个代码,可以供大家参考:
#include <iostream> #include <stdio.h> using namespace std; class test { public: int main() { puts( "test::main hehe" ); return 0; } }; int main() { test x; x.main(); }
如果有知道这个写法,请指教.
本文出自 “LinuxQt济南高新区” 博客,请务必保留此出处http://qtlinux.blog.51cto.com/3052744/1698976
原文:http://qtlinux.blog.51cto.com/3052744/1698976