newlist

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

12 2011 档案

摘要:引用与所代表的变量 共占一段内存 引用不占用内存 因此调用时非常快速并节省空间声明引用必须初始化(除作为参数和返回值)int &b=a;声明引用后,不可再被当做其他变量的引用int a1,a2;int &b1 = a1;b1 = a2; //ERROR指针变量也是变量 因此有指针变量的引用没有void 引用,引用的引用,指向引用的指针、引用数组、空引用需要指出的是 常量不能被引用 const int to int& is errorconst int to int const & is right指针的引用类型 *&指针引用名 = 指针;int n = 阅读全文
posted @ 2011-12-04 14:10 一枚程序 阅读(227) 评论(0) 推荐(0)

摘要:#include <iostream>using namespace std;template <class T> class B { public: void show(T a); };template <class T> void B<T>::show(T a) { cout<<a<<endl; }template <class T1,class T2> class A:public B<T2> { public: void Test(T1 a,T2 b); };template <cla 阅读全文
posted @ 2011-12-03 23:56 一枚程序 阅读(247) 评论(0) 推荐(0)