tags:

views:

225

answers:

6

Hello everybody,

Here's my situation: I taught myself C++ (albeit rather badly), and was later taught how to use Java in college. Returning to C++, I find myself confused by several things that differ from C++ to Java, for example memory management and avoiding memory leaks.

What would be the best mode of returning to programming in C++? Should I read a beginner's guide again, or are there some good references for my kind of situation?

All help is appreciated and thanks!

+8  A: 

There are books especially for your desire, check out:
C++ for Java programmers by Mark Allen Weiss, or by Timothy Budd.

Here are some links:

Shimmy
I wouldn't say that, for each is own pov. anyway I changed the link.
Shimmy
+3  A: 

If you already know the basics of C++ then I would recommend reading Effective C++ by Scott Meyers. It contains a wealth of tips and guidelines for writing better C++ code. Unlike previous editions, the third edition of the book was revised to take into account that readers were coming from backgrounds other than C coding (Java being one of those).

Chapter 3 of the book deals with Resource Management, including how to avoid memory leaks.

hallidave
I love Scott's books, but I would not recommend them for anybody unless they already have a fairly good grasp of C++. The recommendations are based on explaining in details why things should be done. Nearly all these explanations are way beyond the casual C++ user.
Martin York
+12  A: 

If you never properly learned C++ (you say you learned it "badly"), start over. Forget everything about Java, because trying to use Java idioms and techniques in C++ is just a recipe for bugs and memory leaks and very inefficient code. The differences between the languages are fairly big.

So get a good book teaching C++ from scratch.

jalf
+1, C++ and Java are as different as a Lunar night from a Venusian day.
greyfade
This book makes no real recommendation on *what* text to choose. Doesn't get to the heart of the question, IMO - so i downvote.
jdt141
I didn't ask for a book recommendation, I asked for a strategy, @jdt. This answer is the most upvoted because it gives a good strategy and explains why it's a good strategy.
adam_0
Oh ok I misinterpreted. "C++ reference", to me, means a book, website, or some other outstanding body of knowlegde. Whatever works for you, my friend!
jdt141
+3  A: 

I would recommend C++ Primer Plus by Stephen Prata. A bit dry, but very focused.

You might also want to consider The C++ Standard Library by Nicolai M. Josuttis

Jim Rush
+1  A: 

This is one of the best I've used. Explains how its not C, or "C with Classes".

Effective C++

jdt141
+3  A: 

I recommend you to start from the scratch. There are already lot of answers holding good books with it. Follow any one of those, though I myself liked C++ Primer.

And for your question

What would be the best mode of returning to programming in C++?

IMO there is only one mode. It is Practice, practice, practice.

liaK