摘要: 原文链接:http://www.cppblog.com/newcnzz/archive/2012/09/29/192428.htmlC++提供了四个转换运算符:const_cast <new_type> (expression)static_cast <new_type> (expression)reinterpret_cast <new_type> (expression)dynamic_cast <new_type> (expression)dynamic_cast: 通常在基类和派生类之间转换时使用; static_cast: 一般的转换, 阅读全文
posted @ 2012-10-07 05:54 wangkangluo1 阅读(768) 评论(0) 推荐(1) 编辑
摘要: 原文链接:http://www.cppblog.com/jialisoft/archive/2012/09/26/192071.html首先展示一个最简单的单例模式例子,代码如下:classNetworkService{public://对外提供的唯一方法函数,用于获取唯一的对象指针staticNetworkService*GetInstance(){if(m_pInstance==NULL){m_pInstance=newNetworkService();}returnm_pInstance;}private://构造函数设置为私有,禁止用户另外创建对象NetworkService();st 阅读全文
posted @ 2012-10-07 05:44 wangkangluo1 阅读(483) 评论(0) 推荐(0) 编辑
摘要: 原文链接:http://www.cppblog.com/jialisoft/archive/2012/10/04/192742.html#include<stdio.h>intmain(intargc,char**argv){#ifdefMY_MACprintf("Hello-D.\n");#elseprintf("MY_MACwasnotdefined.\n");#endifreturn0;}上面的代码中使用了MY_MAC宏,【】$g++ -DMY_MAC -o dtest dtest.c执行结果:【】$./dtestHello-D.【】$ 阅读全文
posted @ 2012-10-07 05:42 wangkangluo1 阅读(732) 评论(0) 推荐(0) 编辑
摘要: 原文链接:http://www.cnblogs.com/zhangpengshou/archive/2008/10/19/1314424.htmla Array数组b BOOL (int)布尔(整数)by Unsigned Char (Byte)无符号字符(字节)c Char字符(字节)cb Count of bytes字节数cr Color reference value颜色(参考)值cx Count of x (Short) x的集合(短整数)dw DWORD (unsigned long)双字(无符号长整数)f Flags (usually multiple bit values)标志( 阅读全文
posted @ 2012-10-07 05:36 wangkangluo1 阅读(1376) 评论(0) 推荐(0) 编辑