Page 1 of 1

Using Templates for Game Object Inheritance

Posted: Mon May 30, 2011 2:05 pm
by Mattonaise
I've stumbled across this article and it seems kinda interesting:

http://blog.terava.info/past/2011/1/4/g ... ce_in_cpp/

It looks like a cool way to improve object inheritance, but what are your guy's thoughts on it?

Re: Using Templates for Game Object Inheritance

Posted: Mon May 30, 2011 2:23 pm
by bnpph
I use CRTP all the time - it is very handy.

I prefer it over dynamic inheritance.

Re: Using Templates for Game Object Inheritance

Posted: Mon May 30, 2011 2:48 pm
by Mattonaise
Im not sure if I'm correct, but it seems like a way to pick and choose your super classes via templates. Is this right?

Re: Using Templates for Game Object Inheritance

Posted: Mon May 30, 2011 3:15 pm
by XianForce
Mattonaise wrote:Im not sure if I'm correct, but it seems like a way to pick and choose your super classes via templates. Is this right?
Yeah, pretty much.

I really enjoyed reading it, and after a few link jumps, and reading through other opinions on different ways to style objects, I'm content with the way I have my own set up. Although I am considering changing the way I have components communicate with each other.

Re: Using Templates for Game Object Inheritance

Posted: Mon May 30, 2011 8:47 pm
by Mattonaise
Furthermore, it seems like a way to have a sort of "component system", but built at compile time instead of runtime.

Re: Using Templates for Game Object Inheritance

Posted: Tue May 31, 2011 10:38 pm
by XianForce
Mattonaise wrote:Furthermore, it seems like a way to have a sort of "component system", but built at compile time instead of runtime.
Yeah, that's essentially what it is. I'm curious as to how different "Mix-Ins" communicate with each other.