Master the key points of C/C ++ (1)
9. Stack
Stack: A memory area stored for the program. It is used to save status data. Its access sequence is post-import, first-out (LIFO ). For example, the address, parameter, and sometimes local variable of
// Heap sorting. cpp: Defines the entry point for the console application.
// The time complexity is nlgn.
// Create the maximum heap
# Include "stdafx. h"
# Include
Using namespace std;
Int A [100];
//
// Maintain the heap nature
// A is the
The meta-function of a class is defined outside the class scope, but has the permission to the private member of the category class. A function or the entire class can be declared as a friend of another class.
To declare a function as a
// Implement the Prim algorithm (using the adjacent table Storage). cpp: Defines the entry point for the console application.
//
# Include "stdafx. h"
# Include "stdafx. h"
# Include
# Deprecision MAX 100
# Define Infinity 65535
Typedef int
Both gcc and g ++ are GNU compilers.
But there are some differences between the two: The. c file gcc treats it as a c program, and g ++ as a c ++ program. Both the suffixes are c ++ programs. For cpp programs, both gcc and g ++ are the same in the
In C ++, normal functions can be inherited, but destructor and constructors cannot. Here is a question: can C ++ assign values be inherited?
See the following code:
# Include
Using namespace std;
Class {
Public:
A (){
A = 0;
Cout
}
A &
In C ++, we often need # include to include other header files when writing header files. Objects defined in header files often use other header file facilities.
It is so common to include other header files that even one header file is
Due to malloc's inefficiency, he has been searching for a replacement solution. Finally, he thought about how to encapsulate a FastMM DLL as the memory manager of C ++, and then reload the global new and delete operators.
After the above method
Elite Trend
C ++ is a language that has aroused numerous disputes.
The most common voice at the moment is that C ++ will gradually fall and be replaced by a certain language.
I doubt that the starting point of this argument is commercial propaganda.
C ++ has been a lot used in the last two years. C ++ is a little unfamiliar and often uses PYTHON, or read some JAVA code. It feels that C developers are inherently flawed in software engineering due to the C language, as a result, the development
15.5 class scopes under InheritanceIn the case of inheritance, the scope of the derived class is nested in the scope of the base class. If the name cannot be determined in the scope of the derived class, search for the definition of the name in the
15.5.3 scope and member functionsWhen a member function with the same name is used in the base class and derived class, its behavior is the same as that of the data member. In the scope of the derived class, the member of the derived class will be
The earliest contact with the callback function should be learned from the sqlite database (remember that this sqlite_exec () is useful to it), but at that time I did not understand it seriously, I always think the callback function is mysterious.
After learning C ++ for a long time, I found that I still had no in-depth understanding of C/C ++, So I bit my teeth and started to understand C ++ programming ideas ..I used to learn C ++ directly. I didn't know C very well, but I learned C ++ in
16.4 class template members
2. QueueItem class
// QueueItem. h# Ifndef QUEUEITEM_H# Define QUEUEITEM_HTemplate class QueueItem;# Include "QueueItem. cpp"# Endif// QueueItem. h# Ifndef QUEUEITEM_H# Define QUEUEITEM_HTemplate class QueueItem;#
I was lazy yesterday. I want to make up for it today.
Clause 10: Make operator = return a reference to * this
Have assignment operators return areference to * this
One interesting thing about assignment is that you can write it as a chain.
Int x,
Clause 21: when an object must be returned, do not think about returning its reference
Don't try to return a reference when youmust return an object
Once programmers grasp the efficiency of object value transfer, many people will focus on
1. Basic Requirements1.1 program structure analysis, easy to understand, the number of program lines of a single function cannot exceed 100.1.2 What are you going to do? It should be simple, straightforward, and code should be streamlined to avoid
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