全局静态函数的定义和实现

来源:互联网 发布:windows主进程rundll32 编辑:程序博客网 时间:2024/06/07 19:41


在实现一个全局函数的时候,编译报了一个错误


LimitInstance.cpp:24:50: error: cannot declare member function 'static LimitInstance* LimitInstance::getInstance()' to have static linkage [-fpermissive]
 static LimitInstance* LimitInstance::getInstance(){
                                                  ^

上网查了查,原来静态函数只要在定义的时候需要static关键字,实现的时候就不需要了,否则会报错。 


为什么会这样定义,不知道。。。 

0 0