模板函数和模板类

定义3个参数,第3个参数用于表示返回值类型

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 a
    return  a < b ? b : a;
}


template <class Type>
class TNumber
{
public:
 ~TNumber()
 {
 }

 void SetItem(Type);
 Type GetItem();
private:
 Type m_item;
};


posted on 2012-09-21 21:01  linzuxin  阅读(112)  评论(0编辑  收藏  举报

导航