#include <iostream>
#include <string.h>
using namespace std;
class Students05{
public:// 只有非静态成员变量才算存储空间,其他都不算
    int s_a;    // 非静态成员变量,算对象的存储空间
    double s_c;
    // 成员函数 不算对象的存储空间
    void fun1(){
    }
    // 静态成员变量,不算对象的存储空间
    static int s_b;
    // 静态成员函数,不算对象的存储空间
    static void fun2(){
    }
};
int Students05::s_b = 20;
int main()
{
    // 空类占一字节空间
    Students05 stu1;
    cout << "sizeof: " << sizeof(stu1)<< endl;
    return 0;
} 













![[Shell编程学习路线]——探讨Shell中变量的作用范围(export)](https://img-blog.csdnimg.cn/direct/9a35acc2336d468599968e63c736200d.png)





