In the sample:
#include
using namespace std;
class B
{
public:
virtual void pvf() = 0;
};
template
class D : public B
{
p
Each specialisation of a class template gives a different class - they do not share any members with each other. Since you've explicitly specialised the entire class, you don't get any of the members from the template, and must implement them all.
You can explicitly specialise individual members, rather than the entire class:
template <> void D::pvf(){ cout << "bool type" << endl; }
Then D
will still contain all the members of the class template that you haven't explicitly specialised, including the default constructor.