正在加载图片...
Parameterized Types(cont) template< typename valtype class btnode //forward declaration template typename valtype class btnode //class definition public The valtype in Class template is used as a space reserver pI rivate valtype m Val a It's a type parameter that int m icnt could replace any built-in BTNode* Child BTNode* rchild type or user-defined type }; while runningParameterized Types (cont.) template < typename valtype > class BTNode; //forward declaration //… template < typename valtype > class BTNode //class definition { public: //… private: valtype m_Val; int m_iCnt; BTNode* lchild; BTNode* rchild; }; ◼ The valtype in class template is used as a space reserver ◼ It’s a type parameter that could replace any built-in type or user-defined type while running
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有