Several minutes to learn how to use C ++

Source: Internet
Author: User

Many programmers learn the C ++ program and sum up experience. Some people think that C ++ is an independent language, not based on C, you can directly learn C ++ without starting with C. I hope that the introduction in this article will bring you useful knowledge.

C ++ is a powerful language that can be used for tasks that other languages cannot do. However, this powerful feature comes at a cost. When you start to use C ++, you may encounter problems such as memory overflow and access failure, causing the program to crash. Here we will give a brief introduction to the basics of the C ++ language. The C ++ language has its own monograph. This book is still very thick, so don't expect me to be clear in just a few words. After learning this book and using C ++ Builder for a general period of time, the reader finally gives a more in-depth understanding of the C ++ language.

C ++ can take full advantage of Object-Oriented Programming (OOP. OOP is not just a new term, but has its practical significance. It can generate reusable objects. The new term object, like the component described above, is the software block component that completes a specific programming task, but the object is not all component, which will be explained later ).

Objects only show the required parts to the programmers who use the objects. This simplifies the use of objects. All internal mechanisms that users do not need to know are hidden behind the scenes. All of this is included in the concept of object-oriented programming. OOP can be programmed in a modular way to avoid starting from scratch each time.

The C ++ Builder program is oriented to OOP, because C ++ Builder uses a large number of components. After a component is generated, you can use it again in any C ++ Builder program. The components can also be expanded to generate new components with new functions through inheritance. The best thing is that the component hides all content details, allowing programmers to focus on making full use of the component.

Getting started

C language is available before C ++. C ++ is built on C language and is called "C language with classes ". This C language is still very important in today's C ++ programs. C ++ does not replace C, but supplements and supports C. The remaining part of this chapter and the following chapters mainly introduce the C language.

In fact, the C language is introduced here. Only C ++ is transferred to C ++ in Lesson 2nd "C ++ basics. Readers do not have to worry about which is from C and which is from C ++, because all these are in C ++. C ++ is difficult to introduce in sequence, because all the features we will introduce are cross-cutting. I prepared an introduction and pieced it together. By the end of Lesson 3rd "Advanced C ++", you will have a complete understanding of the C ++ language. It doesn't matter if you don't have a certain concept. Some concepts must be fully understood after practice.


Why is it so cool? It is because the true reason behind the "language competition" that has been prevalent in the programmer community is not the essence of language, but the observer's eyes. In the eyes of the observer, language is not a tool, but a skill that has spent more than N times, especially C ++, to "cultivate, being denied is undoubtedly equivalent to being denied.

Therefore, in psychology, language is not a tool, although it has always been such an appeal), but a belief. This belief is more intense in the language that takes a long time. Interestingly, almost all "busy" communities have such phenomena: Java, Python, Ruby... No, because even if the language itself is not complex, programmers still need to invest a lot of energy to learn a variety of framework class libraries and think about those Java frameworks ?). Therefore, the beliefs of these language communities are not necessarily stronger than those of the C ++ community.

However, once we find out why we regard language as a belief, it is very helpful to get rid of the "self-service prejudice" when we look at the language and look at the problem from an objective perspective. -- "When you see evidence that supports an opinion, try to think about what evidence does not support it ".

So why should we get rid of the self-service bias? To be a little bit small, it is to become a better programmer who does not want to use an inefficient language or even an inappropriate language because of prejudice ). If it is too big, it is life-saving because prejudice may lead to deeper and deeper traps and a waste of time ). Therefore, if you can think rationally about the issues we will discuss and avoid self-service bias, just when you have never spent the same time on C ++ ). Then we can start to discuss the real problem.

Nowadays, almost all people who learn C ++ programs know that the core issue of C ++ is its complexity. Even those who do not exist in the C ++ community are aware of this fact. The eyes of the masses are bright, not to mention the fact that this is too obvious.

I have read countless articles describing the complexity of C ++, and I have discussed the complexity of C ++. I wrote two articles about C ++ ). I have always felt like a blind person. As a reader of "Why C ++" criticized, I did not specify in my article what is C ++'s "non-essential complexity ".

Of course, I can know it by myself, and even if I have been in contact with C ++ for a while, however, new users or even non-beginners have no specific understanding of what I call "non-essential complexity, this leaves the article "Why C ++" out of its original intent-oriented to all C ++ users and learners.

For the same reason, after writing the article "How should you learn C ++", Mr. Meng asked me to write a series of articles for "programmer, let me introduce my attitude and understanding in the process of getting in touch with C ++. Although I was very happy to agree, I still had no choice but to accept it three months later.

Why? Because I don't think the real nature of the problem is clearly touched; so I haven't done anything until now, so I don't want to talk nonsense, except for being able to read as a novel, it may not be of practical use to those who really want to learn or even use C ++.

However, such an idea has always been placed in the subconscious. A while ago, I communicated with Bjarne and talked about some ideas about the complexity of C ++. I summarized the complexity of C ++ in my email, and I felt a lot clearer. The purpose of this article is to convey a specific and clear understanding of the complexity of C ++. With this understanding as a support, we can then export the best practices for learning C ++.

Why should I learn and use it?) C ++

Obviously, if you cannot find the reason for learning the C ++ program, it is nonsense to talk about the "correct learning method.

First, repeat Bjarne's statement: "Our system is already extremely complex. To avoid the complexity of C ++, we simply don't need the C ++ Linus approach ." In all areas where C and C ++ are available, C ++ is a better language than C. When I say "better", I mean C ++ has a safer type check, better abstract mechanism, and better database than C.

Of course, there are exceptions in everything. If project 1 you are working on is not large. 2) No abstract mechanism is used in encoding, or even ADT abstract data types, such as std: complex, which does not contain Polymorphism or inheritance), and RAII does not, the exception is also unavailable. 3) You don't need to connect to the basic library, such as smart pointers and containers that simplify resource management.

  1. Introduction to C ++
  2. Summary Notes on learning and exploring C ++ library functions
  3. Basic Conception and method of C ++ Class Library Design
  4. Does C ++ really have market value?
  5. Basic Conception and method of C ++ Class Library Design

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.