C++ STL二(类模板)

创作人QQ:851301776,邮箱:[email protected],欢迎大家一起技术交流,本博客主要是自己学习的心得体会,只为每天进步一点点!

个人座右铭:
1.没有横空出世,只要厚积一定发。
2.你可以学历不高,你可以不上学,但你不能不学习

一、类模板

1.类模板的定义

        在类模板内部“类型形参”可以像其他具体类型一样,用于成员变量成员函数成员类型(内部类)甚至基类声明。      

        template<class 类型形参1,....> class 类模板名{...};

举例:

template<calss A, class B> 
class CMath {
public:
   A m_a;
   B func(){....}; 
};
#include <iostream>
using namespace std;

template<class T>class CMath{
public:
    CMath(T const& t1, T const& t2):
                m_

猜你喜欢

转载自blog.csdn.net/weixin_43155199/article/details/125971034