Quote:Original post by Peter Stephenson Which is better to use? the procedural and structure based approach of C or the Object Oriented development of C++
It depends on your situation. This isn't the type of question that has one "true" answer. I've found that generally OO has done a better job for me. Also note that you can use a procedural and structure based approach in C++ and mix it with OO, if you so desire.
Quote:Does using inheritance have an impact on performance? (i know the use of virtual functions does but other than that?)
Not really. Where i've noticed improvements is the amount of time it takes me to get a project finished and the amount of bugs in my games (both of which are better for me in OO).
In other types of programming (business) objects become more difficult to define, but objects in a game are quite obvious. The OO paradigm as is it relates to games offers quite a bit in the way of organization and code reuse that isn't possible or is much more sloppy using procedural methodologies.
Quote:Original post by snk_kid 5. You can do OO in C.
How so? I never learned plain C, but I haven't really heard this before.
Sure you can, its just that there is no support in the language itself.
There is not support for advanced structures that are more r less a help in OO programming (polymorphism, inheritance, and so on). OO programming is not about creating classes, it is about cutting your problem in object and messages (a message is sent by an object to another. C++ call them methods). There is no real need to reproduce a complex OO language system to use OO.
Some project tried (with some success) to reproduce the behavior of known OO language. or example, you might have a look to GTK+ and GLib.
I think both C and C++ are wonderful languages. Perhaps that is because they are the only two that I know! :-)
Seriously though, the C++ performance impact is usually negligible [sp?]. The only place where virtual functions would make a noticeable impact is for objects that have many instances in your program. For example, many books claim that it is unwise to use any virtual functions in something as fundamental as a Vector/vertex class. This is because if you have several thousand polygons, the vertex count is going to shoot up pretty quickly, and those extra couple of cycles for virtual functions may make a slight impact.
Bottom line... don't really worry about C++ performance... it's still faster than Java. ;)
However, I am currrently finding out the following: If you're trying to learn 3d programming, often it is easier to just use plain C. Let me explain why. If you're just starting out, and trying to master something, often it makes sense to concentrate all of your efforts on learning the new material, as opposed to learning new stuff AND making it architecturally sound via OOP. In other words, once you learn how to do the stuff, then go ahead and go overboard with OOP and concentrate on software engineering approach (ie, design and plan of the code).
There's nothing that takes you away from learning 3D programming faster than spending the time to make all these classes with overloaded operators, and making sure that you get the design right. For example, you can do vector operations in C using a few typedef's and a few #defines, but for an OOP approach, you want to "design it right" and it ends up being a couple hundred lines of code just to do what you were doing before.
I know many people with disagree with me, but that's my opinion on it. As I am still trying to master 3D programming, I find it is much simpler to stick with C until I have a firm grasp on what's going on.. then later I'll probably take the time to plan everything out and implement in C++.
Quote:Original post by Emmanuel Deloget There is not support for advanced structures that are more r less a help in OO programming (polymorphism, inheritance, and so on). OO programming is not about creating classes, it is about cutting your problem in object and messages (a message is sent by an object to another. C++ call them methods). There is no real need to reproduce a complex OO language system to use OO.
Thats not exactly what i mean't and never said its going to be easy either.
Quote:Original post by Emmanuel Deloget Some project tried (with some success) to reproduce the behavior of known OO language. or example, you might have a look to GTK+ and GLib.