vs2010编译C++静态成员函数的引用

Agatha ·
更新时间:2024-09-20
· 729 次阅读

  //CTest.cpp:定义控制台应用程序的入口点。   //   #include"stdafx.h"   #include<iostream>   using namespace std;   class Tc{   private:   int a;   static int b;   public:   Tc(int t){   a=t;b=b+t;   }   static void display(Tc C){   cout<<C.a<<''<<C.b<<endl;   }   };   int Tc::b=2;   int_tmain(int argc,_TCHAR*argv[])   {   Tc A(2),B(4);   Tc::display(A);   Tc::display(B);   system("pause");   return 0;   }   



vs2010 c+ 函数 静态 静态成员 C++

需要 登录 后方可回复, 如果你还没有账号请 注册新账号