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

// 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;
}

 

posted @ 2015-05-23 11:56  bksqmy  阅读(288)  评论(0编辑  收藏  举报