template derivation from another class?
I could use some help with the following concept:
suppose i have a class that contains virtuals
Code:
class b {
public:
b(int n) : _num(n) {};
virutal int do() = 0;
private:
int _num;
};
tempate <class c >
class a {
a ( int r) {
c_ = new c(r);
c_.do();
}
}
class d: class b {
public:
d(int n): b(n) { } ;
}
//usage example
main () {
a<d> var( 5 ) ;
}
I would like to enforce that the template class c type be inherited from b... How can this be done using templates ?
thanks
Ken