分类: C/C++
2010-02-23 14:36:02
#include class Myclass { public: Myclass(int a, int b, int c); void GetNumber(); void GetSum(); private: int A, B, C; static int Sum; };//注意这里的分号 ===============下面是 .cpp文件============== int Myclass::Sum = 0; Myclass::Myclass(int a, int b, int c) { A = a; B = b; C = c; Sum += A+B+C; } void Myclass::GetNumber() { cout<<"Number="< |