Run Code | API | Code Wall | Misc | Feedback | Login | Theme | Privacy | Patreon |
TypeSizeTestSize of char : 1 Size of int : 4 Size of double : 8 ------------------------------- size of Fruit is 32 size of Apple is 40 ------------------------------- 测试输出最原始结构 the memory of Fruit--------------------- Address of Fruit: 0x 0x7ffc7579b3a0 | Size = 32 78 24 40 00 00 00 00 00 c0 b3 79 75 fc 7f 00 00 ed e9 43 2b 00 00 00 00 3c 09 40 00 00 00 00 00 ------------------------------- the memory of Apple--------------------- Address of Apple: 0x 0x7ffc7579b4e0 | Size = 40 90 24 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ------------------------------- 去掉虚函数后的定义 the memory of Fruit1--------------------- Address of Fruit1: 0x 0x7ffc7579b320 | Size = 24 00 00 00 00 00 00 00 00 68 e1 df 2d df 7f 00 00 88 b4 79 75 fc 7f 00 00 ------------------------------- the memory of Apple1--------------------- Address of Apple1: 0x 0x7ffc7579b3c0 | Size = 32 ff ff ff ff 00 00 00 00 00 3d bd 2d df 7f 00 00 e8 e9 27 2d df 7f 00 00 00 d0 dc 2d df 7f 00 00 ------------------------------- 添加构造函数后的定义 the memory of Fruit2--------------------- Address of Fruit2: 0x 0x7ffc7579b3e0 | Size = 32 a8 24 40 00 00 00 00 00 01 00 00 00 df 7f 00 00 c3 f5 28 5c 8f c2 02 40 63 00 00 00 00 00 00 00 ------------------------------- the memory of Apple2--------------------- Address of Apple2: 0x 0x7ffc7579b510 | Size = 40 c0 24 40 00 00 00 00 00 01 00 00 00 00 00 00 00 c3 f5 28 5c 8f c2 02 40 63 00 00 ff 09 00 00 00 64 00 00 00 00 00 00 00 ------------------------------- 父类子类虚函数不同名的情况 the memory of Fruit3--------------------- Address of Fruit3: 0x 0x7ffc7579b400 | Size = 32 d8 24 40 00 00 00 00 00 01 00 00 00 df 7f 00 00 d9 ce f7 53 e3 a5 0b 40 63 e7 be 2d df 7f 00 00 ------------------------------- the memory of Apple3--------------------- Address of Apple3: 0x 0x7ffc7579b540 | Size = 40 f0 24 40 00 00 00 00 00 01 00 00 00 00 00 00 00 d9 ce f7 53 e3 a5 0b 40 63 00 00 00 09 00 00 00 64 00 00 00 00 00 00 00 ------------------------------- 定义顺序调整(虚函数同名)(优化后) the memory of Fruit4--------------------- Address of Fruit4: 0x 0x7ffc7579b340 | Size = 24 10 25 40 00 00 00 00 00 63 db dc 2d 01 00 00 00 6d e7 fb a9 f1 d2 11 40 ------------------------------- the memory of Apple4--------------------- Address of Apple4: 0x 0x7ffc7579b420 | Size = 32 28 25 40 00 00 00 00 00 63 00 00 00 01 00 00 00 6d e7 fb a9 f1 d2 11 40 64 30 60 00 09 00 00 00 ------------------------------- 纯虚函数是否影响 the memory of Apple5--------------------- Address of Apple5: 0x 0x7ffc7579b440 | Size = 32 40 25 40 00 00 00 00 00 63 b7 79 75 01 00 00 00 d3 4d 62 10 58 39 16 40 64 00 00 00 09 00 00 00 ------------------------------- 测试元素分布 the memory of Fruit2--------------------- Address of Fruit2: 0x 0x7ffc7579b460 | Size = 32 a8 24 40 00 00 00 00 00 01 00 00 00 df 7f 00 00 c3 f5 28 5c 8f c2 02 40 63 00 00 00 00 00 00 00 ------------------------------- the memory of Fruit2--------------------- Address of Fruit2: 0x 0x7ffc7579b480 | Size = 32 a8 24 40 00 00 00 00 00 03 00 00 00 df 7f 00 00 c3 f5 28 5c 8f c2 02 40 62 e7 be 2d df 7f 00 00 ------------------------------- the memory of Apple2--------------------- Address of Apple2: 0x 0x7ffc7579b570 | Size = 40 c0 24 40 00 00 00 00 00 02 00 00 00 00 00 00 00 0e 2d b2 9d ef 27 1b 40 65 00 00 00 09 00 00 00 64 00 00 00 00 00 00 00 ------------------------------- the memory of Apple2--------------------- Address of Apple2: 0x 0x7ffc7579b5a0 | Size = 40 c0 24 40 00 00 00 00 00 03 00 00 00 df 7f 00 00 0e 2d b2 9d ef 27 1b 40 66 9d 94 2d 08 00 00 00 61 3a bd 2d df 7f 00 00 ------------------------------- the memory of Fruit41--------------------- Address of Fruit41: 0x 0x7ffc7579b360 | Size = 24 10 25 40 00 00 00 00 00 63 e1 df 2d 01 00 00 00 da 1b 7c 61 32 b5 44 40 ------------------------------- the memory of Fruit42--------------------- Address of Fruit42: 0x 0x7ffc7579b380 | Size = 24 10 25 40 00 00 00 00 00 62 00 00 00 02 00 00 00 da 1b 7c 61 32 b5 44 40 ------------------------------- the memory of Apple41--------------------- Address of Apple41: 0x 0x7ffc7579b4a0 | Size = 32 28 25 40 00 00 00 00 00 63 00 00 00 01 00 00 00 da 1b 7c 61 32 b5 44 40 64 00 00 00 09 00 00 00 ------------------------------- the memory of Apple42--------------------- Address of Apple42: 0x 0x7ffc7579b4c0 | Size = 32 28 25 40 00 00 00 00 00 67 00 00 00 01 00 00 00 da 1b 7c 61 32 b5 44 40 65 00 00 00 08 00 00 00 ------------------------------- |
λ
.NET NoSQL database for rapid development
|