How to learn the C + + language

Source: Internet
Author: User

Yesterday wrote a How to learn C language, someone replied to ask me how to learn C + +, so I put my personal learning experience here, I hope that everyone practical. First of all, because of how to learn C language in the algorithm and system, so here just talk about C + + language.

    • C + + is the hardest language . The most difficult programming language in the world may be a non-C + + mo. You must not think a few days will be able to learn c++,c++ learning curve is quite bt, you can read this article. C + + is a very free language, free to a bit of BT and terror to the point. I even think that C + + is not a mature programming language, because too easy to make a mistake. So, you have to be very careful and cautious at the beginning, and think of C + + as a beast that is hard to train to see .
    • ask "Why do you want to do this" question . Learn C + + must ask a few more "why is this", "with what to do" problem. For example: Very many people know that C + + has copy constructors and initialization lists, but do you really know why you have copy constructors? Why do you want to have a list of initializations? Why should there be a template, why should have rtti, why not other? Is it just to make a language cool? Not at all, no matter what a feature in C + + has some real reasons, you must understand why you should design C + + For this reason, you can learn C + +. Take a look at the book "C + + evolution and Design".

  • reading books, a lot of C + + books。 You can read in the following order for example (the following books, I spent about 4-5 years, today I am still at any time review)
    • "C + + Primer", this 0 basic reader may make you eat very painful, all the characteristics of the language and why are inside, read well. Of course, the C + + 's father wrote "C + + programming language" is also good. It would be nice to read one of the two books (I see the former).
    • Understanding C + + syntax is only the first step of Long March, you also need to see "effective C + +" and "more effective C + +" These two books are not thick, but I have seen from 02 now, every time I read a new experience, these two books are too classic. If you are not familiar with C language, these two books would let you go back to the C language class.
    • Think in C + + is also a classic extreme book, learn C + + must read, but the Chinese version of the translation is very bad, so or to read the English version of it.
    • "C + + meditation" is equally well worth reading, which teaches not programming, but the method of thinking, which is quite precious.
    • "Exceptional C + +" and "more exceptional C + +" let you look at the solutions to various problems and some common classic mistakes.
    • "Advanced C + +" and "Modern C + +" let you know the various ways to use C + +.
    • Generic programming and STL is the most extreme thing about C + + practice. Very powerful. stl--Template Libraries (containers, algorithms, and function objects) are not to be obeyed.
    • The in-depth exploration of the C + + object model gives you an idea of what C + + is like under the compiler, so you know that C + + performance is not bad. This is too critical for the C + + program ape. I have written "C + + virtual function table parsing" and "C + + Object memory Layout" belongs to this category.
    • and Java language Control . I personally think that Java has made a lot of adjustments, specifications and limitations to the immature language of C + +. So, comparing Java and C + +, think about why some things can be done in C + +, but not in Java. For example: Java exceptions are required to catch, or they will not compile. Why doesn't Java provide operator overloading? Why does Java introduce interfaces to do multiple inheritance? Why doesn't Java have a stream of I/O characters like C + +? Why does Java not support pointers? Why is Java able to do garbage collection? Wait a minute. Java embodies a lot of object-oriented design, learning Java can help you learn how to better use C + + to program .
    • Object-oriented design . Although object-oriented may be a scam. But I think some of the practice in object-oriented design is very good, for example, the single principle, dependency inversion principle, and so on, are very classic. "Design mode" must be read, "Object-oriented analysis and design" can be read. but it is not possible to design patterns for the center of programming, but should be used in design mode to solve the lotus root .
    • Class Library Learning . See how MFC encapsulates the Windows API, see how Aces are object-oriented, see how boost plays object-oriented, and see how cppunit is designed. Of course, there are too many design patterns in Java's JDK that can be tested.

I hope not to scare everyone, and welcome you to add.

————— Update 2011/03/30 19:20 ————

Update several ideas:

    • 2 "C + + has very many kinky tricks, some very bt, Contains a virtual function table, perhaps some people think it is a little boring, but I think it is very interesting, on the one hand can understand the implementation of a language, and one aspect can broaden the thinking. I have benefited a lot from learning this knowledge.
    • 4 "This kind of article on the net has a lot of very much, I am not the first to write this article, I am not writing the best, I do not want to use a lengthy talk about what. Just want to give you a look at the general study. After all, C + + is profound, no matter what an article can not be said. It's easier than that.

(Reproduced this site article please indicate the author and the source of cool Shell –coolshell.cn, do not use for whatever commercial use)


How to learn the C + + language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.