2015年6月12日

类成员函数

摘要: 1 /* 类成员函数 */ 2 3 4 #include 5 6 using namespace std; 7 8 // 类成员函数指针 类成员二级函数指针 类成员函数指针数组 9 10 11 class op12 {13 public:14 op(int x,int y):a... 阅读全文

posted @ 2015-06-12 17:46 Dragon-wuxl 阅读(171) 评论(0) 推荐(0)

类模板与静态函数

摘要: 1 /* 类模板与静态函数 */ 2 3 /* 类模板静态函数 */ 4 5 #include 6 7 using namespace std; 8 9 // 类,类模板的静态成员函数不可以访问this10 // 类模板没有实例化 没有调用就不会编译11 12 template13 cla... 阅读全文

posted @ 2015-06-12 17:14 Dragon-wuxl 阅读(421) 评论(0) 推荐(0)

类模板与静态成员

摘要: 1 /* 类模板与静态成员 */ 2 3 4 // 对于static成员,每一个实例化的类的静态成员都是互相独立的 5 6 #include 7 8 using namespace std; 9 10 template11 class myclass12 {13 public:14 ... 阅读全文

posted @ 2015-06-12 16:34 Dragon-wuxl 阅读(123) 评论(0) 推荐(0)

友元实战访问类模板

摘要: 1 /* 友元实战访问类模板 */ 2 3 #include "dialog.h" 4 #include 5 #include 6 #include 7 8 template 9 class mywindow10 {11 private:12 T *p;13 void sh... 阅读全文

posted @ 2015-06-12 16:20 Dragon-wuxl 阅读(102) 评论(0) 推荐(0)

类模板友元类以及友元类模板

摘要: 1 /* 类模板友元类以及友元类模板 */ 2 3 #include 4 5 using namespace std; 6 7 template class myclass;// 类的存在说明 8 class runit;// 类的存在说明 9 template class runall;/... 阅读全文

posted @ 2015-06-12 16:10 Dragon-wuxl 阅读(138) 评论(0) 推荐(0)

类模板与友元

摘要: 1 /* 类模板与友元 */ 2 3 #include 4 5 using namespace std; 6 7 templateclass myclass;// 声明友元类的存在 8 templatevoid show(myclass my);// 友元函数的声明 9 10 templat... 阅读全文

posted @ 2015-06-12 15:34 Dragon-wuxl 阅读(113) 评论(0) 推荐(0)

抽象模板类的用途

摘要: 1 #include "dialog.h" 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 //模板可以让类与数据类型无关,泛型的概念 9 //多态,一个接口,可以无限拓展,实现软件的可定制可拓展10 11 template... 阅读全文

posted @ 2015-06-12 14:43 Dragon-wuxl 阅读(122) 评论(0) 推荐(0)

模板与普通类的多态

摘要: 1 /* 模板与普通类的多态 */ 2 3 #include 4 5 using namespace std; 6 7 // 类继承于类模板 8 9 // 类模板继承于类,仍然存在多态机制10 11 12 class myclass13 {14 public:15 int x;16... 阅读全文

posted @ 2015-06-12 12:25 Dragon-wuxl 阅读(96) 评论(0) 推荐(0)

模板的继承多态以及多继承多态

摘要: 1 /* 模板的继承多态以及多继承多态 */ 2 3 #include 4 5 using namespace std; 6 7 template 8 class myclass 9 {10 public:11 myclass(T a,T b):x(a),y(b)12 {1... 阅读全文

posted @ 2015-06-12 11:01 Dragon-wuxl 阅读(169) 评论(0) 推荐(0)

类模板与类的相互继承

摘要: 1 /* 类模板与类的相互继承 */ 2 3 #include 4 5 using namespace std; 6 7 // 类继承与类模板:要求类模板实例化 8 9 // 类模板继承于类模板:要求类模板实例化 10 11 // 类模板继承于类:要求类模板实例化 12... 阅读全文

posted @ 2015-06-12 08:48 Dragon-wuxl 阅读(240) 评论(0) 推荐(0)

导航