測試組1:
#include <iostream>
using namespace std;
int main()
{
class test
{
public:
int a;
long long c;
char b;
};
cout << "size of test="<<sizeof(test) << endl;;
class test1
{
public:
int a;
char b;
long long c;
};
cout << "size of test1=" << sizeof(test1) << endl;;
class test2
{
public:
int a;
long long c;
char b;
int d;
};
cout << "size of test2=" << sizeof(test2) << endl;;
system("pause");
return 0;
}
#include <iostream>
#pragma pack(push, 1)
using namespace std;
int main()
{
class test
{
public:
int a;
long long c;
char b;
};
cout << "size of test="<<sizeof(test) << endl;;
class test1
{
public:
int a;
char b;
long long c;
};
cout << "size of test1=" << sizeof(test1) << endl;;
class test2
{
public:
int a;
long long c;
char b;
int d;
};
cout << "size of test2=" << sizeof(test2) << endl;;
system("pause");
return 0;
}
#include <iostream>
using namespace std;
int main()
{
class test
{
public:
int a;
long long c;
char b;
};
cout << "size of test="<<sizeof(test) << endl;;
class test1
{
public:
int a;
long long c;
char b;
int dasda(){
return 0;
};
};
cout << "size of test1=" << sizeof(test1) << endl;;
class test2
{
public:
int a;
long long c;
char b;
virtual int dasddaa()=0;
};
cout << "size of test2=" << sizeof(test2) << endl;;
system("pause");
return 0;
}