In my game, I have a class Drawable, which is just an interface class with a few pure virtual functions. Derived from that I have an SfmlDrawable, which is never directly used, but the classes derived from SfmlDrawable are. To save myself the hassle of defining a new class for each drawable I wanted to have, I opted to do it this way:
And have the implementation of the overridden functions in a .cpp file.
Any arguments against this or is this acceptable?
I don't know why you're doing it like this with templates. I read this earlier but I was a little stupified. It's not at all like what I have :
Can you explain why you need the template, and can't simply derive new classes with out it?
I've seen people use templates as a way to get 'compile time polymorphism'.
To reduce overhead from virtual calls when they can all be easily resolved at compile time. But I've never seen anybody use this thing. I don't even know what I'm looking at honestly.
I chose for a template implementation for two reasons:
All classes except an SfmlDrawableFactory uses Drawable*'s. So I never need an instance of SfmlDrawable anyway.
Like I said in the OP, I don't want to need to define a new class when it's constructor will be exactly the same as the one from SfmlDrawable. All drawables will have enough data to fully initialize themselves in their init() method. Actually: this "reason" to do it just comes from pure lazyness on my part 
OT:
/* * _______ ___ ____ __ _______ _______ * /\ ____\ /| \ / __\ /\ \ /\ ____\ /\ ____\ * \ \ ___/_ || _ \ | /__/____\ \ \ \ \ ___/_ \ \ _____ * \ \ ____\ || |_\ \ |\ \ /_ _\\ \ \ \ \ ____\ \ _____ \ * \ \ ___/_ || ___ \ \ \ //\ / \ \ ____\ \ ___/_ / ____\ \ * \ ______\||_|__/_\ \ \ _/ | \ _____\\ ______\ /______\ * /______/|/_/ /_/ ______/ /_____/ /______/ /______/ */
That is some seriously mangled ASCII art...
It's Matthew's code parser, cuz it looks fine here in my editor. 
As for OT, I still don't get it. What classes will derive from SFML drawable? Why? Just to inherit a draw and init method? That seems kinda silly. Are these gonna be full objects or what? What are these things that you're making a class for?
As for OT, I still don't get it. What classes will derive from SFML drawable? Why? Just to inherit a draw and init method? That seems kinda silly. Are these gonna be full objects or what? What are these things that you're making a class for?
typedef SfmlDrawable<Player, sf::CircleShape> SfmlPlayer;
This is how I make a new class. Player is a class from my game, and is an entity that runs around on the game world. All SfmlPlayer needs to be able to draw itself is a circle, which is initialized in the overridden init method. That is as far as "inheritance" goes here. SfmlPlayer, SfmlZombie, SfmlBullet,... actually are SfmlDrawable specializations.
The other option is to do this:
And write those last 10+ lines of code for SfmlZombie, SfmlBullet,...
My method comes from pure lazyness not wanting to write quasi-identical code for each drawable class. It's just more concise(ie: It only costs me three lines(+ implementation of those two functions) to add SfmlPlayer).
Also, as I said, I never need the fact that they are a specialization of SfmlDrawable, only that they derive from Drawable.
Templates are code generators, and since all SfmlDrawable classes have the same class layout, it's easier to automate the code generation.