Advertisement

Is C++ worth the trouble????

Started by August 29, 2002 06:54 PM
16 comments, last by BadgerC82 22 years, 3 months ago
hi all, I''m a C programmer who is now working with Direct x and making some small projects. What I''m interested to know is how many people who program in C++ actually take advantage of Polymorphism and Inheritence and all the OOP (Object - Orientated Programming) stuff in general. I also code in Java at University and that is a totally OOP language so I have to do it there. Is it worth learning the C++ syntax or should I continue to use C with the odd touch of C++. Any comments appreciated
Most of the game industry has migrated to C++.

I use various forms of polymorphism daily. Not only is there run-time, inheritence based, polymorphism, there is compile-time, template based, polymorphism as well.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Advertisement
Yes, it''s worth it. Start learning.

---
John Hattan
The Code Zone
Sweet software for a saturnine world

(my byline from the Gamedev Collection series, which I co-edited) John Hattan has been working steadily in the casual game-space since the TRS-80 days and professionally since 1990. After seeing his small-format games turned down for what turned out to be Tandy's last PC release, he took them independent, eventually releasing them as several discount game-packs through a couple of publishers. The packs are actually still available on store-shelves, although you'll need a keen eye to find them nowadays. He continues to work in the casual game-space as an independent developer, largely working on games in Flash for his website, The Code Zone (www.thecodezone.com). His current scheme is to distribute his games virally on various web-portals and widget platforms. In addition, John writes weekly product reviews and blogs (over ten years old) for www.gamedev.net from his home office where he lives with his wife and daughter in their home in the woods near Lake Grapevine in Texas.

i use the c++ features only when they make sense to do so... there tools and you only use the right tools for the job. but use whatever your comfortable with.

Get busy livin'' or get busy dyin''... - Shawshank Redemption
Get busy livin' or get busy dyin'... - Shawshank RedemptionIf a man is talking in the forest, and no woman is around to hear him, is he still wrong? - UnknownFulcrum
I understand that some of the industry has gone over. But I still see advertisements asking for C\C++ so it must still be in use. Is there a performance increase in C++.

In Java the benefits of OOP is just re-useable code and a more natural design approach.
The C++ syntax is the Java syntax BTW. You should find it easy to switch from one to the other, as long as you remember that C++ has no built-in garbage collection (ie, delete everything you new ).

But the C/C++ thing comes down to a matter of preference. Speaking personally, as someone who programmed in pure C for many years before switching to C++, I've found that programming in C++ using classes, operator overloading, inheritance and polymorphism has made my code easier to understand and more intuitive. There are often times when C++'s inheritance saves me time.

I do however, readily admit that my old style of writing C programs had a lot of room for improvement, mostly because of my lazyness. I guess writing programs using classes just forced me to organise my code better. Properly written C modules can be just as well organised as C++ classes, or so I've been told by reliable sources.

____________________________________________________________
www.elf-stone.com

[edited by - benjamin bunny on August 29, 2002 8:10:08 PM]

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

Advertisement
Benjamin,

Thanks I think you hit the nail on the head for me. The problem with me and C++ is my design approach. In Java the files are classes so you design around them. e.g. no globals, defines etc... In C++ the file structure is the same as C. Do you know any good resources for learning code structure in C++

Thanks

[edited by - badgerc82 on August 29, 2002 8:10:34 PM]
The best way I found to learn any new language is to get a book or two.

One catch with C++ when you are learning. C++ was only standardised in 1998. So many of the books out there don't cover the material which was introduced. For the most part C++ was cleaned up with a lot of nice new features. Some of them are templates and containers etc.

Personally, if you're looking for a free option, I would maybe look at Bruce Eckel's books.. http://www.bruceeckel.com

His books are published as a printed book as well, however, he allows you to download a free copy from his website.

Also reading plenty of articles etc on the various websites around etc can always help improve your skills.

Hope this helps.

[edited by - deepdene on August 29, 2002 8:22:27 PM]
Thanks for the help. Decided to finish my current game using C and then go onto C++ and 3d cheers guys

quote: Original post by BadgerC82
Benjamin,

Thanks I think you hit the nail on the head for me. The problem with me and C++ is my design approach. In Java the files are classes so you design around them. e.g. no globals, defines etc... In C++ the file structure is the same as C. Do you know any good resources for learning code structure in C++

Thanks

[edited by - badgerc82 on August 29, 2002 8:10:34 PM]


When I am using C++, I structure my files the same way I do in Java. One header/source per class(plus one for winmain in C++).

---
Make it work.
Make it fast.

"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]

This topic is closed to new replies.

Advertisement