摘要: 本篇文章主要讲解了C++中构造函数、析构函数、拷贝构造函数的容易产生理解上错误的地方。大家也可以作为检验对知识点掌握的情况!首先代码如下:class CStudent {public: CStudent() { } CStudent(CStudent& stu) { } ~CStudent() { }};int main(){ CStudent stu1; CStudent stu2(stu1); // 这行代码如何解释? CStudent stu3(); return 0; } 以上注释的那行代码该怎么解释?实例化了一个对象并显示的调用了默认的构造函数?如果真这... 阅读全文
posted @ 2013-04-23 17:42 0x苦行僧 阅读(347) 评论(0) 推荐(0)
摘要: 相信大家都使用过C语言的库函数:printf("%d%d", 1, 2)的吧,使用确实很方便功能也很强大。但是为什么它可以接受多个参数呢?现在我们来解析一下多参的实现原理,网上也找了一些文章。发现解析得都不全面。并且有BUG。先看如下源码:#include <windows.h>#include <stdio.h>#include <winnt.h>void MySprintf(char* szBuffer, const char* szFormat, ...){ va_list pa; // 定义一个指针 va_start(pa, sz 阅读全文
posted @ 2013-04-22 19:10 0x苦行僧 阅读(464) 评论(0) 推荐(0)
摘要: Windef.h // 基本数据类型的定义WindNt.h // 支持Unicode的类型定义Winbase.h // 内核函数WinUser.h // 用户界面接口WinGdi.h // 图形设备接口函数Windows程序 用户入口WinMain函数在WinBase中如下定义: 1 #ifndef _MAC 2 int 3 WINAPI 4 #else 5 int 6 CALLBACK 7 #endif 8 WinMain( 9 HINSTANCE hInstance,10 HINSTANCE hPrevInstance,11 LPSTR lpCmdLine,1... 阅读全文
posted @ 2013-04-22 16:42 0x苦行僧 阅读(223) 评论(0) 推荐(0)
摘要: 起点 阅读全文
posted @ 2013-04-22 15:57 0x苦行僧 阅读(127) 评论(0) 推荐(0)