模板类与类模板
1 /* 模板类与类模板 */
2
3 #include<iostream>
4 using namespace std;
5
6
7 // 类模板
8 template<class T>
9 class auto_point
10 {
11 public:
12 T *p;// T是什么类型 p就是什么类型的指针
13
14 auto_point()
15 {
16
17
18 }
19 ~auto_point()
20 {
21
22 }
23 };
24
25 class myclass
26 {
27 };
28
29 int main()
30 {
31 auto_point<int> p;// 实例化的就是模板类
32
33 cout << typeid(p.p).name() << endl;
34
35 cin.get();
36 return 0;
37 }
长风破浪会有时,直挂云帆济沧海
posted on 2015-06-11 08:23 Dragon-wuxl 阅读(130) 评论(0) 收藏 举报
浙公网安备 33010602011771号