Archived

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

a_insomniac

To "C "or not to "C++"

Recommended Posts

I have experience in other languages, visual basic, perl and java script,(used at work) but I switched to C for game dev and have been coding in it for about a year or more. But I first started off trying to learn C++ first. I would see alot of small *tip sections that stated, learning C first would be a better approach at learning C++. So I took that route. Needless to say I love C. I could go on talking about C but I wont. My question is this. I have programmed my first game. (---play applause track here---) small but Im happy with it, and I can see where C++ would help. You know inheritance, classes, the whole OOP bit. QUESTION: Is the transistion between C and C++ really that difficult and is it common to mix the two while coding, if its even practical. (Thinking of switching for more control flow and structure over my code, just looking for opinions) a_insomniac If my compiler was voice activated with the voice of my mother-in-law....there would be no errors!

Share this post


Link to post
Share on other sites
Heya, I cant understand peoples reasoning about C++ being like a totally different language.

Its just an extension of C, which gives you some extra tools which (GREATLY) help data structure management mainly. Its actually pretty easy to convert someones C code (eg structs) to C++ (classes).

Grab an intermediate C++ textbook or the C++ for Dummies, which explains C++ to people who know C already. Learn classes and pointers and you will be on the way

Cel

Share this post


Link to post
Share on other sites
I agree with the posts previous to my own, C++ is just some more code for C. You can still do all the same stuff, except you use a C++ compiler, have .cpp files, and get all the new features .

Null and Void
"In this house we obey the laws of thermodynamics!" --Homer Simpson

Share this post


Link to post
Share on other sites
Hmmm, well im glad to here that it is like that, I already know pointers fairly well and I figured the part about structs to classes.
What gets me is when people say. "The difficult part is getting someone to think in terms of Objects" being object oriented .

Thats what makes it seem like a totally different language because of style change and Modular to Object oriented style of thinking .

a_insomniac

Share this post


Link to post
Share on other sites
I still have trouble deciding how my object should interact, I always end up with pointers to parent objects in my contained classes. It seems to snowball too, you add this function that calls the same type of function in that class, and that class calls yet antoher same-type function in some other class...

Share this post


Link to post
Share on other sites
The easy part is the syntax and new constructs.

The hard part is using objects to their full advantage.

Sure you will be able to create some classes and have other classes interact and blah blah, but it will take time to really see that using them in certain ways makes your systems so clear and ''simple''

There is a book that I have just read called DESIGN PATTERNS, and it is not until reading this that I have finally gone AHA! - this OO stuff is amazing.

If you can afford it go and get it - it will not teach you any syntax - you are expected to know it - but it will show you what a real OO system is.

Have fun

Share this post


Link to post
Share on other sites