![ca494b2dee09d7d0a3633476645f842f.png](https://i-blog.csdnimg.cn/blog_migrate/33cdf31e4080cd7d6b6e30a63b040fcb.jpeg)
1)静态成员函数没有this指针。
例如,以下程序在编译时失败,并显示错误“`this'不适用于静态成员函数”
#include class Test { static Test * fun() { return this; // compiler error } }; int main() { getchar(); return 0; }
2)静态成员函数不能是虚拟的。
3)如果具有相同名称和名称参数类型列表的成员函数声明中的任何一个是静态成员函数声明,则不能重载它们。
例如,以下程序在编译时失败,错误为“void Test::fun()’ and `static void Test::fun()’ cannot be overloaded”
#include class Test { static void fun() {} void fun() {} // compiler error }; int main() { getchar(); return 0; }
4)不能将静态成员函数声明为const,volatile或const volatile。
例如,以下程序在编译时失败,错误为“static member function static void Test::fun()’ cannot haveconst’ method qualifier”
#include class Test { static void fun() const { // compiler error return; } }; int main() { getchar(); return 0; }