For users and scholars who first came into contact with the C ++ language, it is very important to understand the concept of the C ++ language. let's first talk about what the C ++ language is, the so-called C ++ language is a widely used computer programming 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.
- C ++ compilation mode description
- Better Design of object-oriented C ++ Language
- Describes the features of C ++ compiling language to the greatest extent.
- Analysis of Native C ++ in Windows Embedded CE
- Summary of C ++ features introduced by famous Microsoft experts
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.
Variable
Let's start with the variable. Variable is actually the name assigned to the memory address. After declaring a variable, you can use it to operate data in the memory. The following are examples. Two variables are used in the following code segments. The statements at the end of each statement describe what happens when the statement is executed:
- int x;// variable declared as an integer variable
- x = 100;// 'x' now contains the value 100
- x +=50;// 'x' now contains the value 150
- int y = 150;// 'y' declared and initialized to 150
- x += y;// 'x' now contains the value 300
- x++;// 'x' now contains the value 301
The new term variable is used as the computer memory address to store a value. Note that the value of x Changes During Variable operations. The C ++ operator of the Operation variable will be introduced later. Variables declared with warnings but not initialized contain random values. Because the memory to which the variable points has not been initialized, you do not know the value of the memory address.
In this example, the variable C ++ is initialized in advance, so x may obtain any value. The exception is that the global variable and the variable declared with static modification are always initialized to 0. All other variables include random values before initialization or assignment. Variable names can contain uppercase letters, lowercase letters, numbers, and underscores (_), but cannot contain spaces or other special characters.
The variable name must start with a letter or underscore. Generally, it is not good to start with an underscore or double underscore below the variable name. The maximum length allowed by the variable name varies with the compiler. It is absolutely safe if the variable name is kept below 32 characters. In reality, any variable name that exceeds 20 characters is not practical.