Archived

This topic is now archived and is closed to further replies.

C++ and Object-Oriented Programming?

This topic is 5150 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have three questions about C++ programming. I don''t know if these sound kind of ridiculous to you guys, but I''m kind of new to the programming scene. 1) What is the difference between Object-Oriented Programming and normal programming in C++? 2) If there is a difference between the two, which do I use to program games? 3) Can you mix them together? (some normal C++ and object-oriented)

Share this post


Link to post
Share on other sites
quote:
Original post by Tride
I have three questions about C++ programming. I don''t know if these sound kind of ridiculous to you guys, but I''m kind of new to the programming scene.

1) What is the difference between Object-Oriented Programming and normal programming in C++?

2) If there is a difference between the two, which do I use to program games?

3) Can you mix them together? (some normal C++ and object-oriented)



1) http://www.iis.ee.ic.ac.uk/~frank/surp99/article2/hm297/

2) Both methods are used by various companies and individuals regarding game development.

3) Yes. Although please note it is not called "normal C++". The two are called Procedural Programming and Object Oriented Programming.

Share this post


Link to post
Share on other sites
quote:
Original post by Tride
1) What is the difference between Object-Oriented Programming and normal programming in C++?

2) If there is a difference between the two, which do I use to program games?

3) Can you mix them together? (some normal C++ and object-oriented)


OOP is a paradigm of computer programming. C++ makes use of it. Normal programming in C++ would include using the OOP.

read the documentation given above and buy some books. It''s deep stuff and you will need some time to assimilate everything.

Share this post


Link to post
Share on other sites
oop:
class MyClass
{
protected:
int someVar;

public:
int getVar() const;
void setVar(int var);
void doSomethingCool();
}

non-oop, in C++:
int someVar;
doSomething()
{
...
}

So basicaly with non-oop functions nad variables are not part of a class. These days OOP is considered to be the norm. However, there will be times when you find non-oop functions to be usefull. You shold never use non-oop variables in an oop program, that is generaly considered very bad style and makes code hard to read.

Overall Use OOP, but use it wisely, and use a little non-oop if you really need to, but be careful. I strongly suggest looking at as much of other people''s source code as you can. It wil help you see what is good design and what is not, it will also help develop your own style.

i hope that helps at least a bit...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by dmikesell
C++ supports *three* programming paradigms, not two: procedural (which is what I assume you mean by "normal", object-oriented, and generic. They can be inter-mixed in the same program, which is one of the bigger selling points of C++ (at least to me).

--
<a href=http://davemikesell.com>Dave Mikesell Software & Consulting</a>


What do you mean by "generic"?

Share this post


Link to post
Share on other sites