Archived

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

Is C++ worth the trouble????

This topic is 5583 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

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
use whatever you are comfortable with. When you are using
c++ it is a misconception that you are not using c.
If by c++ you mean classes/inheritance etc.. then you need
to remember that even though the code is more readable
the actual compiled code is larger and has much more
instructions and thus is a bit slower. Not much but it is
there. So don´t forget to only use the power c++ offers
you only when it is warranted to do so. With c/c++ you basically
have a lot of tools just like a painter has the brushes.
You only use what you need for any particular task. If not then
the work will pretty much be like the painters that only
use some favourite brush(es) most of the time.
Think about how the code is arranged and if you really need
classes for the problem or if you can fix it another way.
It is always easy to take the quick way out but that is most
of the time not the best option.

Share this post


Link to post
Share on other sites
look here:

http://www.icce.rug.nl/documents/cplusplus/

a C++ tutorial designed for C programmers - extremely well written with good source code examples of classes, polymorphism etc. I switched from C to C++ in a matter of weeks with a large degree of confidence after going through this. Good luck.

Share this post


Link to post
Share on other sites
I''m strange, I code in C++ without taking advantage of the extra features then when the code becomes difficult to understand, I take advantage of the inheritence. The point here is that C++ structure makes the code that bit more comprehensible, as opposed to C.

Yes, you should learn it. As you know C it will not be as difficult a ride as you may think.

Regards,
Mathematix.

Share this post


Link to post
Share on other sites
C++ is a godsend for game programmers, especially ones who are writing RPGs or any other game involving large amounts of data for each individual character in the game. I''m only about three weeks into learning C++ (former knowledge: BASIC and a little C) and I don''t think that I could go back to trying to code without classes or OOP.

Share this post


Link to post
Share on other sites
What is a good free version of C++ I can download and use to learn on.

I also want to know why its called C++?

And what is the compiler. Is it something you use in conjunction with C++ to code with?



luke gartrell // melbourne australia

*peace be with you*

[edited by - shinKen on September 1, 2002 11:31:21 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
its called c++ because its one step up from C
eg i++ increments i by 1

Share this post


Link to post
Share on other sites
shinKen:

I live in Queensland, and got Microsoft''s Visual C++ 6.0 (Academic Version) for $120 AUS last year (when I was in year 12). Before that I used a downloaded an older Borland C++ compiler (free), and that was 3 years ago.

Hope that helps.

Wizza Wuzza?

Share this post


Link to post
Share on other sites