There are three different kinds for a template class: non-template friend,
Bound-template, unbound-template. Below is non-template friend function
counts(); The counts is not invoked by an HasFriend obj and has not object
parameters. If counts want to access a HasFriend object, It can access a
global one, and use a global pointer to access non-global object.
A better bound-template, reports has <> after it. and you don’t need
redifne reports many time like previous codes.reports is a templatefunction here. You can think that is a implicit instantiations.
bound friend is specialization of template function, so It has <>
after the function name.
non-bound template use different typename, such as C and D in
previous example, and it also use template keyword
bound template will produce more function implementation
, but non-bound template will only produce ONE function
implementation.
Difference between template function overload and partial specializations
partial specializations is just use in template class.
partial specializations need put another <> after class name
If you want to have custom implementation of function with same
name, use overload function, if you need custom implementation of
class with same name, use partial specialization.