#include <iostream> using namespace std; template <class T> class specific { T value; public: specific(T a) { cout << "Generic specific\n"; value = a; } T getvalue() { return value; } }; // Explicit specialization for float. template <> class specific<float> { int value; public: specific(float a) { cout << "Specific<char> specialization\n"; value = a * a; } int getvalue() { return value; } }; int main() { specific<char> d('a'); cout << "Character value: " << d.getvalue() << "\n\n"; specific<float> i(2.2); cout << "Float value: " << i.getvalue() << "\n"; return 0; }