C ++'s "programming Introduction" and programming Introduction

Source: Internet
Author: User

C ++'s "programming Introduction" and programming Introduction
Basic FeaturesI. Classes and objects1. Object: an object is an actual thing in the real world. It can be tangible or invisible. An object is an entity used to describe an objective thing, is a basic unit of the system. 2. Class: a set of objects with the same attributes and behavioral characteristics. 3. Relationship between classes and objects: class is an abstraction of a group of objects with the same attributes and behaviors; any object is a specific instance of a class.
Ii. Encapsulation1. Meaning: Combine the attributes and services of object s into an independent system unit. Try to conceal the internal structure of the object and keep only limited external interfaces so that it can be connected with the external. 2. Advantages: effectively control the impact of changes within an object on other objects; simplify the use of objects through object interfaces; and facilitate code reuse through inheritance mechanisms;
Iii. Inheritance1. Definition: the object of a special class has all the attributes and methods of its general class. Generally, a general class is called a base class or parent class, and a special class is called a derived class or subclass. 2. Features: passability. 3. advantages: it can be inherited by a layer-by-layer Layer to realize code reuse and improve program development efficiency.
Iv. Polymorphism1. premise: the implementation of polymorphism is based on inheritance. 2. Definition: different objects with inheritance relationships have different behaviors when receiving the same message. 3. advantages: it can provide unified external interfaces for class families formed by different classes with inheritance relationships, greatly improving the stability, maintainability, and reusability of the program, this improves the quality of software.
Software Development ProcessObject-oriented software development process: analysis, design, programming, testing, and maintenance
Program Development ProcessI,C ++ program development stage: editing, preprocessing, compilation, connection, running and debugging 2. C ++ source files usually contain. h ,. c ,. cpp extension 3. The compilation process is divided into three steps: lexical analysis, syntax analysis, and code generation. Step 4: the lexical mark is the smallest program unit. Step 5. The extension of the target program file is. obj
Program StructureI. Notes1. Comment block (multi-line comment ):/*.................. */2. Comment row (single line comment )://..................
2. Except for the pre-processing command and the main function, all other statements end ";"
3. 1. Use # include <iostream> to use the namespace using namespace std; 2. Use # include <iostream. h> without the need to declare the namespace;
4. Common operators:1. oct (octal), dec (decimal), and hex (hexadecimal) values: the integer objects to be output subsequently. decimal places do not work. 2. setw (n ): set the output width. The header file (iomanip) is required. It takes effect only for the next object. 3. setprecision (n): set the number of output decimal places (excluding the decimal point. The default value is 6 digits ); header file (iomanip) is required, and the function scope is subsequent objects. 4. # include statement: it is executed during program running.

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.