Commit 4aceaad1 by PotatoGim

C++: 가상 테이블 디버깅

parent 8938e170
/*!
* ===========================================================================
* @file test.cxx
* @brief
* @author Ji-Hyeon Gim <potatogim@potatogim.net>
* @date 2015년 09월 04일 14시 13분 03초
* @version 1.0
* @copyright Copyleft (c) 2015, Ji-Hyeon Gim
* @license GNU General Public License v3
* ===========================================================================
*/
#include <iostream>
#pragma pack(1)
struct base1 {
virtual void m1() {}
};
struct base2 {
virtual void m2() {}
};
struct base3 {
virtual void m3() {}
};
struct base4 {
virtual void m4() {}
};
struct base5 {
virtual void m5() {}
};
struct cls1 : base2,base1,base3 {
virtual void c1() {}
};
struct cls2 : base4, base5
{
virtual void c2() {}
};
struct cls : cls1, cls2
{
virtual void m7() {}
};
int
main (int argc, char** argv)
{
std::cout << sizeof(int) << std::endl; // 4
std::cout << sizeof(struct base1) << std::endl; // 8
std::cout << sizeof(struct base2) << std::endl; // 8
std::cout << sizeof(struct base3) << std::endl; // 8
std::cout << sizeof(struct base4) << std::endl; // 8
std::cout << sizeof(struct base5) << std::endl; // 8
std::cout << sizeof(struct cls1) << std::endl; // 16
std::cout << sizeof(struct cls2) << std::endl; // 16
std::cout << sizeof(struct cls) << std::endl; // 16
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment