简体   繁体   中英

C++ Reference for Programmer Returning from Java

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!

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.

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:

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

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.

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.

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

Effective C++

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM