编译器:vs2019

#include<iostream>
using namespace std;

class student {
public:
    student(int b) : b(b) {}
    //普通静态成员需要在类外初始化,且省略掉static
    static int num;
    //普通的常量成员,必须初始化,且必须是初始化列表
    const int b;
    //只有静态常量成员才能在类内初始化
    const static int c = 10;
};

int student::num = 10;

int main() {
    student stu(2);
    cout << stu.b << endl;
    system("pause");
    return 0;
}