摘要: 1:怎样样在main函数未开始之前,执行一个函数呢?利用全局变量+类的构造函数 1 #include <iostream> 2 using namespace std; 3 class A{ 4 public: 5 A(int m); 6 }; 7 A::A(int m) 8 { 9 cout<<"constructor fun"<<m<<endl;10 }11 A a(10);//先调用构造函数12 int main()13 {14 cout<<"mian"<<endl;15 sy 阅读全文
posted @ 2012-04-24 20:16 foreverlearn 阅读(341) 评论(0) 推荐(0) 编辑