将函数声明为Static的作用

表示静态函数,它为所有类共有的。调用该函数直接使用类名加上修饰符,如:
Windows win;
Windows::W_SIZE();
而不是:
win.W_SIZE();
静态函数只能处理静态数据成员,不能处理非静态程序,如:
class Window
{
public:
static void W_SIZE();
private:
int a;
static int s;
};

Window::W_SIZE()
{
a = 2; //错误,不能处理非静态成员
s = 1; //正确
}
原文地址:https://www.cnblogs.com/pengjun-shanghai/p/4826746.html