摘要: 1. 基址的概念 基址是什么? 从C++内存模型上来讲, 基址就是一个全局变量, 也就是第一次申明的类的地址。比如有一个类 1 class test 2 { 3 test(); 4 ~test(); 5 6 private: 7 char* name_; 8 int hp_; 9 int mp_;10 role* role_;11 } C++的内存模型是这样的。在new test()的时候, 其对象的地址为 this(比如:0x0040320),那成员变量 name的地址为this(因为没有虚函数列表),hp_的地址为this+0x4, mp_的地址为this+0x8, role_的地址就为. 阅读全文
posted @ 2011-05-15 22:20 sld666666 阅读(872) 评论(0) 推荐(0) 编辑