Basic C + + learning

Source: Internet
Author: User

September 8-11th

Ran through the "C + + Object-oriented programming", with a basic understanding.

Onge "Object-oriented programming" notes

What is Object-object-oriented fundamentals

Header file (. h)

Member variables-Secret of member variables

Constructors and destructors

Initialization of the object (initialization)

New & Delete; new[] & delete[]

-Dynamically allocating memory through malloc in C, which allocates memory through new in C + +, is virtually indistinguishable from the way C is implemented.

-c++, where the data is stored in the computer:

-1. Stack is used to store local variables inside the function

-2. Heap New data

-3. Global Data area: Storing global variables, static variables, static member variables

In-c++, getting data is also taken to these three places, so C + + is a more complex language.

Access restrictions

Initialize list, call before initialization by initialization list

Object combination, composition group becomes a new object

-Another way to build new objects is to construct new object, egg-heart, and egg-clear models through inheritance-the sub-analogy parent has more attributes, the subclass constructs an object than the parent class constructs

Have more properties.

Inheritance-Subclass Parent class relationship, subclasses can be regarded as a parent class, upcast; the parent class is treated as a subclass, downcast, but not necessarily correct; Egg model, subclasses contain more features than the parent class

function overloading and default parameters ()

inline functions, in order to increase the speed of operation using inline functions, because the calling function requires expense

The const pointer's relationship does not change, not to say that the element pointed to is not the same, and static variable is different from static, static is the address in memory unchanged

Non-modifiable objects

The reference to "&" is essentially a pointer to the difference from the Java language.

Upward styling

Polymorphism

Copy Construction

Static objects-static members, placed in the global variable area

Operator overloading

Basic rules. Prototype. Assigned value. Type conversions

Template templates

The basic concept of exception, exception throw and catch, exception statement, the bottom of the discovery of exceptions thrown up, given above to do processing.

Open file determine its size allocate so much memory read the file into memory close the concept of the file stream-flow operator: flow is one-dimensional

STL Brief:

Why should I use STL? Reduce development time Code readability Fit more meaningful stuff on one page ROBUSTNESS-STL data structure Grow automatically standard library data structures can automatically grow portable code portable maintainable Code maintainability Easy

Vector List Deque Sets set maps (mappings, key-value pairs) basic algorithms such as sorting

-Templates and overloads are used, essentially, a container is a class.

Follow-up courses: Onge "C language", "C language Advanced"

Basic C + + learning

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.