类的静态函数成员可以不创建类直接访问
#include "iostream"
using namespace std;
class base
{
public:
static void show()
{
cout << "hello world" << endl;
}
};
int main()
{
base::show();
}
类的静态函数成员不能访问非静态成员
class base
{
public:
static void show()
{
cout << a << endl;
cout << b << endl;
cout << c << endl;
}
int a;
int b;
static int c;
};