正在加载图片...
Function Templates More compact and convenient form of overloading Identical program logic and operations algorithms for each data type Function template definition Written by programmer once Essentially defines a whole family of overloaded functions Begins with the template keyword Contains template parameter list of formal type parameters for the function template enclosed in angle brackets(>) Formal type parameters a Preceded by keyword typename or keyword class u Placeholders for fundamental types or user-defined types COMP 152Function Templates ▪ More compact and convenient form of overloading • Identical program logic and operations/algorithms for each data type ▪ Function template definition • Written by programmer once • Essentially defines a whole family of overloaded functions • Begins with the template keyword • Contains template parameter list of formal type parameters for the function template enclosed in angle brackets (<>) • Formal type parameters ❑Preceded by keyword typename or keyword class ❑Placeholders for fundamental types or user-defined types COMP152 9
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有