42_繼承的內層接結構

當前演示在vstudio中

class Base
{
public:
    int a;
protected:
    int b;
private:
    int c;
};

class Son :public Base
{
public:
    int d;
    int e;
};
int main(int argc, char* argv[])
{
    cout << sizeof(Son) << endl;
    return 0;
}

步驟:

cl /d1 reportSingleClassLayoutSon test.cpp

Son類的佈局:

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章