模板函数和模板类
定義3個(gè)參數(shù),第3個(gè)參數(shù)用于表示返回值類型
template <typename T1,typename T2,typename T3> inline T3 const& max (T1 const& a, T2 const& b) {// if a < b then use b else use areturn a < b ? b : a; }
template <class Type>
class TNumber
{
public:
?~TNumber()
?{
?}
?void SetItem(Type);
?Type GetItem();
private:
?Type m_item;
};
轉(zhuǎn)載于:https://www.cnblogs.com/llinzuxin/archive/2012/09/21/2950486.html
總結(jié)
- 上一篇: halcon--1D measuring
- 下一篇: DLL中使用模板类