弱问类内存问题
#include"iostream.h"
class A
{
public:
int b;
char d;
};
void main()
{
A object;
cout<<"sizeof(b)is"<<sizeof(object.b)<<endl;
cout<<"sizeof(d)is"<<sizeof(object.d)<<endl;
cout<<"sizeof(object)is"<<sizeof(object)<<endl;
}
运行结果为:
sizeof(b)is 4
sizeof(d)is 1
sizeof(object)is 8 //请问这里为什么不是5?请高手赐教!