随笔分类 -  ~~C++编程~~

摘要:new文件用来管理c++的动态内存,这个文件声明了几个全局空间的函数(不是std空间的函数,全局空间的函数调用时是用全局作用域解析符),包括operator new 和operator delete的重载 ,这些函数用于处理动态存储空间请求。其new的头文件源代码#ifndef _NEW#defin... 阅读全文
posted @ 2014-05-19 19:44 OpenSoucre 阅读(928) 评论(0) 推荐(0)
摘要:关于c++多态,个人认为就是父类调用子类的方法,c++多态的实现主要通过虚函数实现,如果类中含有虚函数,就会出现虚函数表,具体c++多态可以参考《深度探索c++对象模型》c语言模拟多态主要通过函数指针实现,可以参考《Object Orientated Programming in ANSI-C》//... 阅读全文
posted @ 2014-05-11 14:56 OpenSoucre 阅读(224) 评论(0) 推荐(0)
摘要:printf("%p",a);取变量的地址 阅读全文
posted @ 2014-01-20 15:56 OpenSoucre 阅读(292) 评论(0) 推荐(0)
摘要:// accumulate example#include <iostream>#include <functional>#include <numeric>using namespace std;int myfunction (int x, int y) {return x+2*y;}struct myclass { int operator()(int x, int y) {return x+3*y;}} myobject;int main () { int init = 100; int numbers[] = {10,20,30}; cout < 阅读全文
posted @ 2013-04-28 19:31 OpenSoucre 阅读(415) 评论(0) 推荐(0)