If foo
is a global object of type T
, you can pass a pointer-to-foo
to the template class X
.
As an example, suppose T
was an ostream
. I can create two logging types, which based on the type output to error or out. Their static
methods can even do it.