antiantantiant.blog.chinaunix.net
antiant
全部博文(32)
线程间通信(9)
进程间通信(0)
网络通信(1)
2010年(32)
大鬼不动
zzbok
36853
分类: WINDOWS
2010-07-03 23:43:08
#include "stdafx.h" #include <memory.h> typedef struct tagTest { int a; int b; int c; }TEST; class CParentTest { public: int GetC(void){return c;}; protected: private: int c; }; class CTest : public CParentTest { public: int GetA(void){return a;}; int GetB(void){return b;}; protected: private: int a; int b; }; int main(int argc, char* argv[]) { TEST oTest; memset(&oTest, 0, sizeof(TEST)); oTest.a = 10; oTest.b = 20; oTest.c = 30; CTest* pCTest = (CTest*)&oTest; int a = pCTest->GetA(); // 20 int b = pCTest->GetB(); // 30 int c = pCTest->GetC(); // 10 return 0; }
上一篇:atoi API
下一篇:检测CPU字节序
登录 注册