Есть простая идея : чтобы не открывать доступ к параметрам программы, хранимым в Cfg.h и не писать кучу селекторов и модификаторов я создал два шаблонных метода GetValue и SetValue Вот содержимое файла Cfg.h //************************************************************ #ifndef _CFG_H_ #define _CFG_H_ #include <string> class ParserCfg { public: template <class T> T GetValue(const std::string name, T defaultValue ); template <class T> void SetValue(const std::string name, T Value); private: std::string inputFile_; std::string configFile_; bool completed_; }; #endif //_CFG_H_ //************************************************************ Но мне приходится в реализации этого класса явно прописывать реализацию методов для всех типов : //************************************************************* #include "Cfg.h" template <> std::string ParserCfg::GetValue(const std::string name, std::string defaultValue ) { if ( name == "inputFile_") return inputFile_; }; template <> void ParserCfg::SetValue(const std::string name, std::string value) { if ( name == "inputFile_") inputFile_ = value; }; template <> bool ParserCfg::GetValue(const std::string name, bool defaultValue ) { if ( name == "completed_") return completed_; }; template <> void ParserCfg::SetValue(const std::string name, bool value) { if ( name == "completed_") completed_ = value; }; //************************************************************* Иначе у меня ничего не работает (пишет undefined reference to ....) Я бы хотел сделать обобщённую реализацию : template <class T> void ParserCfg::SetValue(const std::string name, T value) { if ( name == "completed_") completed_ = value; }; Почему это не работает??? В чём моя ошибка???