Original Post
I have a couple of basic C++ questions, along with 1 relating it back to game programming. That is my reason for posting these in this board verses the normal programming board. First Question: Is there a difference or a benefit in using a class object verses say a struct or typedef struct? I have some general objects that are singleton based that I have been using a typedef struct on and just using that verses a class object. Is there a benefit between using one vs. the other, or is it just personal preference? Second Question: When should a “new” statement be used on an object? I am having trouble figuring out when and why you should use this statement to declare a new instance or new object. For example: cMyObject cThisObject = new cMyObject(); or cMyObject cThisObject; Should a “new” statement be used when declaring it outside a class declaration? Also, what about structs, when should you use the “new” statement on them or should you use them at all? Third Question (tying back in to game programming): Is there a benefit in using structs over class objects in games? Does it matter? I geuss this question may just be opinionated only in why using one over the other. Conclusion: I fully appreciate the responses to these questions. I’m trying to fully understand certain areas that I can not find info on, or the kind of answers I need to fully understand. Like I said, pretty generic questions above but none the less questions I need help with =). Good day to all, Brandon