随笔分类 - ~~C++编程~~
摘要:new文件用来管理c++的动态内存,这个文件声明了几个全局空间的函数(不是std空间的函数,全局空间的函数调用时是用全局作用域解析符),包括operator new 和operator delete的重载 ,这些函数用于处理动态存储空间请求。其new的头文件源代码#ifndef _NEW#defin...
        阅读全文
                
摘要:关于c++多态,个人认为就是父类调用子类的方法,c++多态的实现主要通过虚函数实现,如果类中含有虚函数,就会出现虚函数表,具体c++多态可以参考《深度探索c++对象模型》c语言模拟多态主要通过函数指针实现,可以参考《Object Orientated Programming in ANSI-C》//...
        阅读全文
                
摘要:// 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 <
        阅读全文
                

 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号