Introduction to C++ Programming Series Preface

Source: Internet
Author: User
Keywords c programming ide beginning c++ through game programming c++ programming exercises
Starting today, I will explain to you some knowledge of C++ programming introductory, and will use the simplest language to let readers learn the C++ language and fall in love with this language.
Simple Application Server
USD1.00 New User Coupon
* Only 3,000 coupons available.
* Each new user can only get one coupon(except users from distributors).
* The coupon is valid for 30 days from the date of receipt.

This preface describes the development process of programming languages, object-oriented methods, and basic object-oriented concepts.

As everyone knows, computer languages have grammar and other rules just like human languages. It is a language that computers can recognize and are used to describe methods to solve problems. The computer can read it and do the corresponding work. Using language to describe the method of solving the problem generates a program. The program is composed of many instructions. The instructions that the computer can recognize are the combination of 0 and 1. The language composed of all such instructions is called machine language. It is conceivable that it is all 1s and 0s. It is difficult for software developers to program. The development cycle is long and the functions are not complicated. Later, assembly language appeared, which is to map machine language into mnemonics that people can understand. This makes software development easier, but it is still very different from human thinking, but this is a leap forward. . Finally, a high-level language appeared, and the level of abstraction was relatively high. The meaning of the data can be easily seen in the data naming in the program, and the execution statement is also easy to understand. The structured programming language that appeared in the 1960s has taken a big step forward, but the data and operations in the program are separated, independent of each other, and cannot correspond to real things. Finally, object-oriented programming languages appeared.

Object-oriented programming language regards things as objects with attributes and behaviors, and then finds the attributes and behaviors of things belonging to the same class through abstraction, and then forms a class. Through class inheritance and polymorphism, code reuse can be well realized and software development efficiency can be improved. If you don’t understand this, you can try to understand it first, and you will gradually understand these concepts through later learning.

       In the 1980s, the structured program design method was more popular. Its design idea was to gradually refine the program structure from top to bottom, and divide the program structure into multiple modules according to functions. Each module may be divided into multiple modules. A tree structure of modules is formed, and the relationship between the modules is as simple as possible and relatively independent in function. Each module is composed of three basic structures: sequence, selection and cycle. This method divides a complex program design problem into many simple and detailed sub-problems, which is more convenient for development and maintenance. But the disadvantage of this method is that the data and the method of processing the data are independent. If the data structure changes, all related methods must be changed. At this time, the object-oriented design method appeared. It puts data and methods into a whole. This whole is called an object. Objects of the same type are abstracted into classes. Most of the data in the class can only be processed by the methods in this class. It has a relationship with the outside world through a simple external interface, and the various internal relationships are transparent to the outside.

Here are a few basic concepts of object-oriented:

1. Object. Each object is an entity that describes objectively existing things, and is composed of data and methods (also called attributes and behaviors). Attributes are data describing the characteristics of things, and behaviors describe some operations on object attributes.

2. Class. A class is a collection of objects with the same properties and behaviors. It provides an abstract description for all objects belonging to this class. For example, sparrows and cuckoos can be regarded as objects, and birds can be regarded as classes.

3. Packaging. Encapsulation is to combine all the attributes and behaviors of the object into an independent unit, hide the internal details of the object from the outside, and only retain a few interfaces to communicate with the outside world.

4. Inheritance. A class (called a subclass) can inherit all the attributes and behaviors of another class (called a parent class). For example, cars and cars, cars are inherited from cars, and all the attributes and behaviors of cars are inherited from cars.


5. Polymorphism. Polymorphism means that after the properties and behaviors of the parent class are inherited by the subclass, the subclass can have its own properties or behaviors that are different from the parent class. For example, define a class "animal", which has the behavior of "eating", but how to eat and what to eat, I don’t know, because I don’t know what kind of "animal" it is. If it inherits the subclasses "Sheep" and "Tiger ", "Eating" becomes a specific behavior, and you know how to eat.


Finally, I declare again that the content of this preface may still be a bit difficult for novices to understand, but don't worry, you will gradually understand these through follow-up learning, and then you will find it very simple when you come back to it.

Related Article

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.