Thank you for the reply.
The code above still give the compilation error.
condes.cpp:17: error: template argument 1 is invalid
condes.cpp:17: error: declaration of template ‘template<class T> int NamedObject(const char*, const T&)’
condes.cpp:4: error: conflicts with previous declaration ‘template<class T> class NamedObject’
condes.cpp:4: error: previous non-function declaration ‘template<class T> class NamedObject’
condes.cpp:17: error: conflicts with function declaration ‘template<class T> int NamedObject(const char*, const T&)’
condes.cpp: In function ‘int NamedObject(const char*, const T&)’:
condes.cpp:18: error: only constructors take base initializers
condes.cpp: At global scope:
condes.cpp:24: error: template argument 1 is invalid
condes.cpp:24: error: declaration of template ‘template<class T> int NamedObject(const std::string&, const T&)’
condes.cpp:4: error: conflicts with previous declaration ‘template<class T> class NamedObject’
condes.cpp:4: error: previous non-function declaration ‘template<class T> class NamedObject’
condes.cpp:24: error: conflicts with function declaration ‘template<class T> int NamedObject(const std::string&, const T&)’
condes.cpp: In function ‘int NamedObject(const std::string&, const T&)’:
condes.cpp:25: error: only constructors take base initializers