0

C++ template specialization

Hello everyone! Is it possible to use template specialization for ALL functions in a class? If yes, can you give an example please?

21st Oct 2018, 4:01 PM
H2727
H2727 - avatar
2 odpowiedzi
+ 2
Yeah you can specialize the class itself. template<typename T> class Foo { void speak () { cout << "Hello from Foo<T>"; } } template<> class Foo<int>{ void speak () { cout << "Hello from Foo<int>; } }
21st Oct 2018, 5:27 PM
Schindlabua
Schindlabua - avatar
0
Thanks
21st Oct 2018, 6:12 PM
H2727
H2727 - avatar