In C + +, we can define the so-called symbolic constants by #define This instruction, which is directly compiled into binary code. In this case, it is basically the same as the effect of the constant value variable defined with Const. Of
For
C + + in object-oriented programming, there are static binding and dynamic binding definition, this section is mainly about these two points of distinction.
I am analyzing the inheritance system of a class, so the object described below generally
Recently because of scientific research needs, has been studying Google's Open source RE2 library (regular expression recognition library), the Library source volume is large, written in C + +, for me this previously for the Java people is really a
An array container, which is a container for storing arrays, is an extension of the Type C array, and can be manipulated using iterators;
For example, "Std::array", it should be noted that if directly assigned, "Std::array ia = {1, 2, 3, 4, 5};"
An iterator (iterator) is a pointer type, and also points to the Const pointer itself (address) and the value indicated by the const pointer, in two cases;
But the writing and const built-in pointers are different;
char * const is equivalent to
1. Mandatory type conversion for character type applications:
#include
using namespace std;
int main ()
{for
(int i=32;i
Run Result:
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/cplus/
2. Special
Derived classes are constructed and refactored in a certain order because they want to invoke the base class;
The order of the constructs is: base (base)-> derivation (derived), that is, the base class is constructed first, and then the derived
Demand:
Access authorization profiles are sometimes configured in several dimensions, such as Company|product|sys configuration in this format:
1. Configuration "Sina|weibo|pusher" means that Sina company Weibo product Pusher system can access,
Tuple containers (tuples), which represent tuple containers, are fast and low-quality (shoddy, quick, and dirty) that do not contain any structure, and can be used to return multiple return values for functions;
Tuple container, you can use direct
Calculates the combination number of a number and uses recursion to solve it.
If you calculate the number of 3-bit combinations, first select a fixed digit, and then calculate the remaining two-bit combinations, and finally combine them. such as 1 +
2. InsertFor bidirectional cyclic lists, we can now randomly insert a new node at a known node P or p.If S,p,q is a pointer to three consecutive nodes, if we want to insert a new node R before P, simply point the right link field pointer of S to R,r'
Prevents derived classes from redefining virtual functions, which can be implemented very simply in Java and C # (finale&sealed),
But in C + +, you need to use the method of public inheritance + composite (composition);
Note: You cannot implement
There are three ways to inherit interfaces and implementations, including:
1. Only inherit interface, pure virtual function;
2. Inherit interface and implement, allow overwrite (override), virtual function;
3. Inheritance interface and
The default initialization order for class members is in the order of declaration, and if you initialize a member variable with an initialization list, you must follow the declaration order of the member variable;
Otherwise, when alternating
sizeof (str) = 6; An array of strings with a size of six bytes (plus ' total ' of six).
sizeof (p) = 4; The pointer's content is an integer that points to the destination address, so the 32-bit machine pointer is 4 bytes, regardless of whether it
Problems to solve:
We use the file system of the PC, in fact, is our data structure in the tree structure, we deal with each node in the tree, in fact, regardless of whether he is a leaf node or root node, because their member functions are the
The simple factory pattern, according to the design pattern type, belongs to the creation pattern, which is the simplest one in the factory model, which is not part of the Gof 23 design pattern, but is simple and practical. He has a factory object
An in-depth understanding and application of C51 to standard Ansic is one of the keys to learning C51. Because most of the extension features are directed to the 8051 series CPU hardware. There are roughly 8 categories:
8051 storage type and
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