// This code runs successfully in 32-bit win# Include Using namespace std;Class A // A is an empty class. The compiler will mark this class with A char type and the size is 1.{
};Class B: public A // B inherits A, but it is also an empty class with
Law of emeter)
Definition: one object should have the least understanding of other objects
The core concept of the dimit rule is inter-class decoupling and weak coupling. Only after weak coupling can the reusability of classes be improved.
The
Modern C ++ programs should try to use vector and iterator types, instead of low-level arrays and pointers. Well-designed programs use arrays and pointers only when speed is emphasized.
After declaring a pointer, remember to initialize it. If it is
I. Three SDK functions:
WinExec, ShellExecute, and CreateProcess can meet the requirements for calling other programs. Among them, WinExec is the simplest, ShellExecute is more flexible than WinExec, and CreateProcess is the most complex.Two WinExec
I haven't done any algorithm questions for a long time. I will repeat several simple algorithm questions.Question 1: Calculate the largest sum of sub-ArraysThis is a very common algorithm question. Many people can quickly write algorithms, but many
This article is from an excellent post of CU, which summarizes the static knowledge in a comprehensive manner, so I will share it with you.Generally, static refers to the concept of static storage. In fact, static in c ++ contains two meanings.1)
During the interview, some interviewers are very concerned about some special keywords in C ++;Sorted out some keywords that are more informative.• ExplicitUsed to declare constructors. The declared constructor is a display constructor and cannot be
I. Overview
In the design and implementation of an object-oriented system, object creation is the most common operation.
There is a problem here: if an application uses too many objects, it will cause a large storage overhead. Especially for a large
I. Example
For example, China and Japan have disputes over the Diaoyu Islands. At this time, the United Nations will come up and serve as a mediator. In fact, there is no good mediation. The Diaoyu Islands are China's, and this is an indisputable
Socket pair, also known as socket pipeline, is mainly used to implement one-to-one full or half-duplex communication within or between processes. It is used in IO reuse models (such as select, poll, epoll, etc) it plays a role in notifying the
Compared with C ++, the type of the MFC package is quite uncomfortable, and sometimes it is difficult to change the type. Especially when it is related to encoding, it is particularly depressing and may not be familiar with MFC yet.
Sometimes it is
Volatile is interpreted as "unstable" in English, that is, the value of the variable modified with this keyword may be changed at any time. The type variables declared by the compiler can be changed by unknown factors, such as the operating system,
1. Memory Allocation Method(1) distribution from the static storage area. For example, static and global variables are used. The data in the static storage area has been allocated when the program is compiled. It exists during the running of the
Problem:Specify the coordinates of N points on the plane to locate the two closest points.
Solution:We first sort the x coordinates of N points. We use the fast sorting method with the worst complexity O (n * logn, in the sorting process,
Calculate the width of a binary treeIdea: there are too many solutions for this question. You can search or use the shortest path. I wrote it with dijkstra () and reviewed the dijkstra algorithm.
Code:[Cpp]# Include # Include # Include # Include #
The system size recognition code is provided for reference only.Traditional writing: Int get_order (){Union endian{Short s;Char c [2];} Order; Order. s = 0x1234; If (order. c [0] = 0x12 & order. c [1] = 0x34){Return 1;/* big endian */}Else{Return 0;/
Question:In 1976 the ''four Color Map Theorem "was proven with the degree of a computer. this theorem states that every map can be colored using only four colors, in such a way that no region is colored using the same color as a neighbor region.Here
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