(1)c++会给每一个空对象分配一个内存为1的空间,是为了区分空对象内存占用的位置
每个空对象都有一个独一无二的内存空间
using namespace std;
class person{
};
void test01(){
person p;
cout<<"size of p ="<<sizeof(p)<<endl;
}
int main()
{
test01();
return 0;
}

(2)非静态成员函数属于类,静态成员函数不属于类
#include<bits/stdc++.h>
using namespace std;
class person{
int M_A;//非静态成员变量属于类
};
void test01(){
person p;
cout<<"size of p ="<<sizeof(p)<<endl;
}
int main()
{
test01();
return 0;
}

非静态成员函数属于类
using namespace std;
class person{
static int M_A;//静态成员函数不属于类
};
void test01(){
person p;
cout<<"size of p ="<<sizeof(p)<<endl;
}
int main()
{
test01();
return 0;
}

同时注意非静态成员函数 不属于类对象上
静态成员函数也不属于类的对象上