摘要:
关键的一点在于:静态成员函数只和类型有关,而与对象无关!这样就可以看出静态成员函数和非静态成员函数的根本区别就在于:静态成员函数没有this指针,因为它没有对象,而非静态成员函数有一个指向当前对象的指针this。举例:class A{public: void notStaticFunc(int a); static void staticFunc(int a);}void f(A& s){ s.notStaticFunc(100); //编译时按照A::notStaticFunc(&s,100)进行,把s的地址作为第一个参数。s.staticFunc(100); //我想最好写 阅读全文
posted @ 2010-04-18 11:47
arm-linux
阅读(315)
评论(0)
推荐(1)