在什么基础上,类对象的大小显示为12?
class testvector
{
public : vector<int> test;
};
int main()
{
testvector otestvector;
cout<<"size :"<<sizeof(otestvector)<<"\n";
cout<<"size of int :"<<sizeof(int);
}
Run Code Online (Sandbox Code Playgroud)
输出:
size :12
size of int :4
Run Code Online (Sandbox Code Playgroud)