随笔分类 -  C、C++基础

摘要:http://bigasp.com/archives/486如何正确使用C++多重继承2011年06月17日 — Asp J 原创文章,转载请注明:转载自Soul Apogee本文链接地址:如何正确使用C++多重继承C++多重继承一直是一个让人搞不太清楚的一个问题,但是有时候为了实现多个接口,多重继承是基本不可避免,当然在Windows下我们有强大的COM来帮我们搞定这个事情,不过如果你想自己实现一套类似于COM的东西出来的时候,麻烦事情就来了。在COM里面,有两个很基础的,而且我们都会用到的特性:1. 纯虚接口:一般使用一个只有纯虚函数的类来作为接口2. 引用计数:在C++中一般都使用引用计 阅读全文
posted @ 2013-12-18 20:45 scott_h 阅读(421) 评论(0) 推荐(0) 编辑
摘要:问c 里面内存的堆栈的布局,有什么区别? [剖析程序的内存布局](http://blog.csdn.net/drshenlei/article/details/4339110) [C程序(进程)的内存布局](http://www.cnblogs.com/dejavu/archive/2012/08/ 阅读全文
posted @ 2013-10-18 00:56 scott_h 编辑
摘要:http://www.cplusplus.com/reference/algorithm/for_each/std::move()用于c++11http://www.cplusplus.com/reference/utility/move/c++98// for_each example#include // std::cout#include // std::for_each#include // std::vectorvoid myfunction (int i) { // function: std::cout myvector; myvector... 阅读全文
posted @ 2013-07-04 17:06 scott_h 阅读(397) 评论(0) 推荐(0) 编辑
摘要:template InputIterator find (InputIterator first, InputIterator last, const T& val){ while (first!=last) { if (*first==val) return first; ++first; } return last;}http://www.cplusplus.com/reference/algorithm/find/// find example#include // std::cout#include // std::find#include ... 阅读全文
posted @ 2013-07-04 16:55 scott_h 阅读(215) 评论(0) 推荐(0) 编辑
摘要:函数重载指 重载函数,形参(类型)不同,实现的功能一样。泛型算法指2个方面:这些算法可作用于各种不同的容器类型,而这些容器类型又可以容纳多种不同类型的元素。 阅读全文
posted @ 2013-07-02 19:10 scott_h 阅读(790) 评论(0) 推荐(0) 编辑
摘要:Visual C/C++ compiler 中的__cdecl、__stdcall、__fastcall、thiscall 压栈、退栈区别 阅读全文
posted @ 2013-06-30 13:09 scott_h 阅读(1087) 评论(0) 推荐(0) 编辑
摘要:#ifndef SAFE_ADDREF#define SAFE_ADDREF(p) if (p != NULL) { p->AddRef(); }#endif#ifndef SAFE_RELEASE#define SAFE_RELEASE(p) if (p != NULL) { p->Release 阅读全文
posted @ 2013-06-30 12:32 scott_h 阅读(464) 评论(0) 推荐(0) 编辑
摘要:虚函数虚函数http://zh.wikipedia.org/zh/%E8%99%9A%E5%87%BD%E6%95%B0_%28%E7%A8%8B%E5%BA%8F%E8%AF%AD%E8%A8%80%29这里面有代码解释,很清晰易懂,BCDEF类继承自(A),BCDEF的构造函数各不相同,若是声明 阅读全文
posted @ 2013-06-30 12:31 scott_h 阅读(1213) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示