sizeof(class)

//#define _REENTRANT
//#define _POSIX_C_SOURCE
#include <iostream>
#include <string>
#include <cstdio>
#include <assert.h>
#include <cstring>
#include <error.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <pthread.h>

using namespace std;

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>

class A
{
public:
void virtual aa(){}
//char x;
};

class B:public A
{
void virtual bb(){}
};

class C:virtual A
{
public:
void virtual aa(){}
void cc(){}

//double ch;
};

class D:virtual A
{
public:
//void virtual dd(){}
};

class E: A,B,C, D{
public:
    E() {}
};
class F: A{
public:
    F() {}
};
int main() {
    cout<<"sizeof(A)="<<sizeof(A)<<endl;
    cout<<"sizeof(B)="<<sizeof(B)<<endl;
    cout<<"sizeof(C)="<<sizeof(C)<<endl;
    cout<<"sizeof(D)="<<sizeof(D)<<endl;
    cout<<"sizeof(E)="<<sizeof(E)<<endl;//4*8 64bit multi inherient
    cout<<"sizeof(F)="<<sizeof(F)<<endl;//8
    //cout <<"  -------*"<< endl;
    exit(EXIT_SUCCESS);
}
上一篇:ajax成功跨域_自己写的


下一篇:Catia 二次开发资料(转)