#29320 - greyboy - Wed Nov 17, 2004 9:37 pm
I wasn't sure whether to put this under beginner, coding, or C, so I put it here, since you all are obviously the smartest bunch (shh don't tell the others). :D
Anyhow, I'm wondering about people's opinions on which is better. (For a project in C) Is it better to have an object manager in which everyone calls CreateObject( OBJ_TYPE_BOMB, etc ) which then calls the corresponding create functions for the bomb, for instance. This obj mgr would have fn ptrs to create/update/destroy. Or is it better to have people calling CreateBomb() which would allocate the bomb and register the ptr to the base object data with the obj manager? The base obj of course would be the first element in any "derived" objects. It sounds like the latter is better, but I thought I had seen the former done.
Or perhaps both these approaches are lame and you have a better suggestion? I just have trouble figuring the advantages of the former approach. I figure as long as the derived objects register themselves with the obj manager and the mgr has ptrs to the destroy and update fns it should be ok.
Can someone advise, or even point out areas I have completely neglected that I need to flag?
Thanks
Anyhow, I'm wondering about people's opinions on which is better. (For a project in C) Is it better to have an object manager in which everyone calls CreateObject( OBJ_TYPE_BOMB, etc ) which then calls the corresponding create functions for the bomb, for instance. This obj mgr would have fn ptrs to create/update/destroy. Or is it better to have people calling CreateBomb() which would allocate the bomb and register the ptr to the base object data with the obj manager? The base obj of course would be the first element in any "derived" objects. It sounds like the latter is better, but I thought I had seen the former done.
Or perhaps both these approaches are lame and you have a better suggestion? I just have trouble figuring the advantages of the former approach. I figure as long as the derived objects register themselves with the obj manager and the mgr has ptrs to the destroy and update fns it should be ok.
Can someone advise, or even point out areas I have completely neglected that I need to flag?
Thanks