   Are template inheritance and specialisation mutually exclusive?
  I would like to create a specialisation of..template <typename CEnemy_Ty> class CEnemyManager {};..for a class called CTank which is a CEnemyBut by defining..template <> class CEnemyManager<CTank>{}..it means I have to copy+paste huge chunks of unchanged code, just to change say one or two functions.By defining..class CTankManager: public CEnemyManager<CTank> {};..I think I am then able to overload the functions I want to change, which is tidier.But I don't want the class to be CTankManager. I would like it to be distinctly a CEnemyManager<CTank> since I've got other classes which deal with this template, and this would apply to the CTank class templates too. And also a lot of code is written already so I think it's better if this code didn't know about the change..Cheers guys!Um, just also I wanted to say it would be perfect if I could specialise a single function from a template class somehow. That's what I started off trying to do. But it seems you can only specialise an entire class. So if I could find a way of doing this through inheritance that would be cool..   
  What behavior needs to be specialized exactly? And are you sure that runtime polymorphism wouldn't be more appropriate here?   ;  Thanks for reply,It doesn't really add or subtract anything from the problem, but for what it's worth the template class contains a deque with different enemies and provides a Create() interface to manage my enemies. Create pushes new enemies into the container using their appropriate constructors. Tanks are defined with different constructors, so I need different constructor args, hence different Create(). Moreover, there are some other functions which simply don't exist for any other type of enemy.But I am curious as much from a conceptual point of view as anything else. There are dozens of ways to solve this problem, I'm just hoping to find the best one!And I'm not sure what you mean by runtime polymorphism. So you're saying I should use inheritance?   ;  One solution would be to add the capacity to pass an initialiser through the create function to the constructor for the requested type. Each constructor knows what types of initialisers it can accept, although for safety you might want to enforce some form of run time type checking. Commonly such initialisers are passed through a void* pointer, but you can get more complex by using generic initialisers, or even attribute handles.The alternative is to separate construction and initialisation. Your 'Manager' class may be responsible for constructing, storing and releasing objects but that doesn't mean that it has to cover the initialisation of object state (and there are many good arguments as to why it SHOULDN'T be concerned with this). Presumably your Manager returns a handle/pointer/reference to a requested/constructed object. So pass this off to an initialer function/class along with the attributes you want to set and their values (or just the values in a preset parameter signature) and let the initialiser function/class return the initialised object.Cheers,Timkin   ;  There are a bunch of patterns for customizing templated classes.1) Use policy templates to specialize your class. There is plenty of info on the net, as this is a very common technique.2) Externalize your customization. Have your templated class call a free function which you can specialize via template function specialization.3) Go with runtime customization/polymorphism.If anything, C++ gives you too many options here. ;)   ;  thank you guys, that's a lot of food for thought.   