
C++
geek87
这个作者很懒,什么都没留下…
展开
-
C++指针练习
#include "stdafx.h" #include "Handler.h" //#include //#define DEBUG(format,arg...) printf("debug:"format,##arg) //模板函数 /*templete T abs(T x){ return x<0?-x:x; }*/ //} int _tmai原创 2012-10-27 19:43:27 · 690 阅读 · 0 评论 -
类的基本特点
#pragma once #include "Loction.h" class Animal { public: friend class Loction; //友元类 Animal(void); ~Animal(void); //void print(); //覆盖情况1 父类普通函数 //virtual void print(); //覆盖情况2 父类虚原创 2012-10-27 19:45:06 · 580 阅读 · 0 评论 -
C++指针与引用传递参数
#include "stdafx.h" //#include "Fish.h" //#include "Animal.h" void swap1(int &a,int &b){ //引用 int t=a; a=b; b=t; } //指针传参数 void swap2(int *a, int *b){ int t=*a; *a=*b; *b=t;原创 2012-10-27 19:41:09 · 496 阅读 · 0 评论