下面我们来看虚继承。首先看看这c020类,它从c010虚继承:}
| struct c010 { c010() : c_(0x01) {} void foo() { c_ = 0x02; } char c_; }; struct c020 : public virtual c010 { c020() : c_(0x02) {} char c_; }; |
| print_size_detail(c020) |
| the size of c020 is 6 the detail of c020 is c0 c2 45 00 02 01 |
| c020 c020; c020.c010::c_ = 0x04; |
| 0042387e mov eax,dword ptr [ebp+fffff82ch] 00423884 mov ecx,dword ptr [eax+4] 00423887 mov byte ptr [ebp+ecx+fffff82ch],4 |
| print_obj_adr(c020); c010 * pt = &c020; print_pt(pt); pt->c_ = 0x03; |
| c020's address is : 0012f708 pt's value is : 0012f70d |
| 01 004238ea lea eax,[ebp+fffff82ch] 02 004238f0 test eax,eax 03 004238f2 jne 00423900 04 004238f4 mov dword ptr [ebp+fffff014h],0 05 004238fe jmp 00423916 06 00423900 mov ecx,dword ptr [ebp+fffff82ch] 07 00423906 mov edx,dword ptr [ecx+4] 08 00423909 lea eax,[ebp+edx+fffff82ch] 09 00423910 mov dword ptr [ebp+fffff014h],eax 10 00423916 mov ecx,dword ptr [ebp+fffff014h] 11 0042391c mov dword ptr [ebp+fffff820h],ecx |
| c010 * pt1 = null; c010 * pt2 = pt1; |
| 0042397d mov dword ptr [ebp+fffff814h],0 00423987 mov eax,dword ptr [ebp+fffff814h] 0042398d mov dword ptr [ebp+fffff808h],eax |
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器