My header file has
template
class AA : public BB
{
public:
AA()
{ ... }
this is working fine. But I need to separate the constructor implementation from header file.
So in cpp, I have
template
AA::AA()
{ ... }
When I compile this, it compiled but I get unresolved external symbol error. What am I missing here?
Answer
You can explicitly instantiate templates in your implementation file using :
template class AA;
this will generate a definition from a template, but it is of use only if you know what types your class clients will use
No comments:
Post a Comment