This the problem I am facing. I have a Base class which has several virtual functions declared and defined. I also have several Derived classes inherited from Base. Each derived class wants to override only some of the member functions of Base. And the sets of member functions to override by different derived classes are different. Maybe the following code explains better:

/////////////////////////////////////////////////////////////////////
/// Solution A

class Base
{
public:
Base(int i, int j) {}
virtual void funcA() {//do something in funcA}
virtual void funcB() {//do something in funcB}
virtual void funcC() {//do something in funcC}
virtual ~Base() {}
};

class Derived1 : public Base
{
public:
Derived1(int i, int j) : Base(i, j) {}
virtual void funcA() {// override funcA}
};

class Derived2 : public Base
{
public:
Derived2(int i, int j) : Base(i, j) {}
virtual void funcB() {// override funcB}
virtual void funcC() {// override funcC}
};

// More derived classes possible

/////////////////////////////////////////////////////////////////////

The above code is ok and did what I wanted. But there are a few drawbacks also. First, because C++ does not have constructor forwarding yet, we have to tediously call Base constructor in each derived classes constructor. Second, it's tedious to give different names to those derived classes, especially when there's a clear naming rule (e.g. "Derived" followed by an integer).

So I thought class template may be a good solution, as follows:

////////////////////////////////////////////////////////////
/// Solution B

template <int i>
class Derived : public Base
{
public:
Derived1(int i, int j) : Base(i, j) {}
virtual void funcA() { Base::funcA(); }
virtual void funcB() { Base::funcB(); }
virtual void funcC() { Base::funcC(); }
};

// Then specialize a member function if needed:

void Derived<1>::funcA() { // override funcA }

void Derived<2>::funcB() { // override funcB }
void Derived<2>::funcC() { // override funcC }

///////////////////////////////////////////////////////////

This way I solved the two problems mentioned above. The only thing I don't like is:

virtual void funcX() { Base::funcX(); } // "X" could be A, B or C

This has to be done because to be able to override it, I have to declare it in the derived class. But because not all derived classes will override all member functions, I have to provide a default definition for them (calling Base class implementations). I kind of feel this may cause an overhead of two indirections, am I right?

Now comes my question: Is something as follows possible? I know the following won't compile, but is looking for something as simple but valid.

//////////////////////////////////////////////////////
/// Solution C : ideal case, but not practical???

template <int i>
class Derived : public Base
{
public:
Derived1(int i, int j) : Base(i, j) {}
// Do not declare functions, use them from Base class if needed...
};

// But still be able to specialize a member function if needed:

void Derived<1>::funcA() { // override funcA }

void Derived<2>::funcB() { // override funcB }
void Derived<2>::funcC() { // override funcC }
/////////////////////////////////////////////////////////

Thanks!