I am learning C++ templates.I created a template class for addition of two strings but I'm getting folloing error: Please help me to understand this error.
main.cc:65:52: error: no matching function for call to TheNameHolder<std::basic_string<char> >::TheNameHolder(const char [8], const char [7])
using namespace std;
template <class T>
class TheNameHolder{
T *a, *b;
public:
TheNameHolder(T *first, T *last)
{
a= first;
b= last;
}
T getName();
};
template <class T>
T TheNameHolder<T> :: getName()
{
T returnVal;
returnVal = strcat (returnVal,a);
returnVal = strcat (returnVal, " ");
returnVal = strcat (returnVal, b);
return returnVal;
}
int main()
{
TheNameHolder <string> obj ("Hi", "");
cout << obj.getName ();
return 0;
}