I. Introduction to the environment

Programming IDE: VS Code

The code in this article is compiled on a running environment: Windows

Full PDF download address (last update) : download.csdn.net/download/xi…

Note to Zhihu:

C++ is an object-oriented computer programming language invented and implemented by Dr. Benjani Strausup of AT&T Bell LABS in the early 1980s (originally called C with Classes). It is a general-purpose programming language with static data type checking and support for multiple programming paradigms. It supports procedural programming, data abstraction, object-oriented programming, generic programming and many other programming styles. C++ is the inheritance of C language, further expand and improve C language, become an object-oriented programming language. The word C++ is often pronounced “C plus plus” among mainland Chinese programmers, while western programmers often pronounce it “C plus plus”, “CPP”.

C++ is the upgraded version of C language, which can not only carry out the procedural programming of C language, but also can carry out the abstract data type programming, and also can carry on the object-oriented programming characterized by inheritance and polymorphism.

C++ developed from C language, fully compatible with C language, written C language code can be used in C++ unchanged. C language is process-oriented language, C++ on this basis increased the object-oriented and generic programming mechanism, so C++ is more suitable for the development of large and medium-sized programs.

Object-oriented programming has no advantage in code execution efficiency compared with process-oriented programming. It is mainly proposed for large-scale programs in development, aiming at improving the efficiency of software development.

C++ introduction guide

2.1 Content Introduction

C++ introduction guide mainly explains the basic content of C++, suitable for learning C language children’s shoes advanced learning; The content of the article starts from THE C++ part directly, and the C language part is not mentioned, so it is necessary to learn THE C language in advance, and then continue to advance.

Articles from the beginning of the environment to build, test and operation program, c + + class, object, inheritance, overloading and polymorphism, templates, began to explain, post code and clear specification, illustrated the complete order, fully in accordance with the standards published books written style, have color code, looks transparent, can be directly copied test run. Very suitable for daily development, learning reference book use, will continue to update (update will directly update the replacement resources PDF).

2.2 Directory Introduction

C++ beginner’s guide… 1

C++ language basic introduction and development environment construction… 1

1.1 introduction to C++… 1

1.2 Object-oriented Programming… 1

1.3 building a C++ learning environment in Windows… 2

C++ basic introduction… 16

2.1 C++ classes and objects… 17

2.2 C++ namespaces… 18

2.3 STD Standard Namespace… 20

2.4 C++ added standard input and output methods (cin and cout) 22

2.5 C++ specified variable definition position… 24

2.6 new Boolean types in C++ (bool)… 24

2.7 C++ new and delete operators… 25

2.8 default parameters of C++ functions 26

2.9 C++ function overload details… 28

2.10 new reference syntax in C++… 30

C++ object-oriented: classes and objects… 34

3.1 Class definition and object creation… 34

3.2 Class member variables and member functions… 36

3.3 Class Member access rights and Class encapsulation… 38

3.4 C++ class constructors and destructors… 39

3.5 Object Array… 47

3.6 This pointer… 50

3.7 static Static member variables… 52

3.8 Static Member functions… 53

3.9 Const Member Variables and Member functions… 55

3.10 Const object (constant object) 56

3.11 Friend Functions and Friend Classes… 58

3.11.3 Friends… 61

3.12 C++ string… 62

C++ object-oriented: inheritance and derivation… 75

4.1 Introduction to Inheritance and Derivation… 75

4.2 Introduction to Inheritance Syntax… 75

4.3 Inheritance Methods (Inheritance Permissions) 76

4.4 Variable and Function Names Are Obscured during Inheritance…… 79

4.5 Constructors for Base and Derived Classes… 82

4.6 Destructors for Base and Derived Classes… 83

4.7 Multiple Inheritance… 85

4.8 Virtual Inheritance and Virtual Base Classes… 88

C++ polymorphism and abstract classes 91

5.1 Introduction to Polymorphism… 91

5.2 Virtual Functions… 92

5.3 Pure Virtual Functions and Abstract Classes… 95

C++ operator overloading… 97

6.1 Operator Overloading Syntax… 97

6.2 Overloaded and Non-Overloaded Operators… 98

6.3 Unary Operator Overloading… 99

6.4 Binary Operator Overloading… 102

6.5 Relational Operator Overloading… 104

6.6 Input/output Operator Overloading (>>, <<) 105

6.7 Function Call Operator () Overload… 106

[] (subscript operator)… 107

C++ templates and generic programming… 108

7.1 Function Templates… 108

7.2 Class Template 110

2.3 Content Details