I've several classes (D3, D4, etc) which I would like to pass to the constructor of class C. All of these classes (D3, D4, etc) derived from an abstract class called AbstractGroup. I'm having problem of defining the constructor of C. Here is the code:
Code:
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

template<class Type>
class AbstractGroup {
public:
	virtual Type	element(int) const = 0;
	virtual int	order() const = 0;
	virtual Type	inverse(const Type& x) const = 0;
	virtual Type	operation(const Type& left, const Type& right) const = 0;
};

class D3 : public AbstractGroup<string> {
//...
};

class D4 : public AbstractGroup<double> {
//...
};

class C {
public:
	C(const AbstractGroup<class Type>& g) {}
};

int main()
{
	D3 d3;
	C c(d3);  //Error: 'C::C(const AbstractGroup<Type> &)' : cannot convert 
                      //parameter 1 from 'D3' to 'const AbstractGroup<Type> &'

	return 0;
}
I could write C's constructor as template. But I want to restrict the use of C to only those classes which are derived from AbstractGroup. How can I do that? Please help. Thanks for your time.