Template Class{Public:Typedef t a: * unspecified_bool_type; // another type, pointing to the T pointer, but this type belongs to a and must be declared
Add a :, ..
Operator unspecified_bool_type () const{M_p = 3;Return & A: m_p; // you must use :
The Memory Length occupied by struct variables is the total memory length occupied by each member. Each member occupies its own memory unit.
The Memory Length occupied by the shared body variable is equal to the longest member length.
Note:
For an empty class, the compiler generates four member functions by default: default constructor, destructor, copy constructor, and assign value function.
It is best to enable memory detection when using malloc.
If (H = (stud *) malloc
Today we know the header file , and new can also do this: Use new to not allocate memory space, just call the constructor, as shown below:Code
# Include #include class cmyclass {public: cmyclass () {STD: cout
In the above formula new (void *) 1
Always use Emacs to write c ++Program, Sometimes switch between. cpp and. H files. The followingCodeThis function can be implemented (bound to F11) and added. in the emacs file, it is depressing that during debugging, because the regular expression
/* Think it's okayProgramCan run in various compilers, soCodeDevelopers should be careful and learn the truth! */INT main () {int A = 42; printf ("% d \ n", );}
What is the problem with the above small program? What do you think? Add the following
Is the "C ++" in the "Turing comments" losing competitiveness? The C/C ++ user's journal is closed. "(http://blog.csdn.net/turingbook/archive/2006/05/18/743389.aspx"), or C ++ is going into recession. Personally, I think it is inevitable to go
Overload (overload), that is, function overload:
In the same class;
The function name is the same;
Function parameters are different (for different types and quantities, either of them is sufficient );
Different return value types are
Polymorphism:
Operator overload
The operator overload is implemented by creating the operator function operator. Example: complex operator + (complex A, complex B ){}
Generally, you can use the following two methods after using the member
Calculate the number of 1 in the binary number, mainly using m-1)
Exchange A and B without intermediate variables, or: A = a ^ B; B = a ^ B; A = a ^ B
Sizeof is not a function. It is a special keyword similar to macro definition. As long as it
Memory alignment. For the following classes:
Class B {
Public:
Int M_a;
Short int m_ B;
Double M_c
PRIVATE:
Int m_d;
Public:
Int getvalue () {return M_c ;}
};
You can guess the size of Class B objects. If you guess it is 18 (4 + 2 + 8 + 4), you
3 Function
3.1 inline functions
Rule 3.1 inline function is smaller than 10 rows
Note: an inline function has the characteristics of a general function. It differs from a general function only in the processing of function calls. General
A pointer is a special variable. The value stored in it is interpreted as an address in the memory. To understand a pointer, we need to understand four aspects of the pointer: the pointer type, the pointer type, the pointer value, or the memory zone
Compile preprocessingThree preprocessing commands1. macro definition2. Include files # include3. Conditional compilation
Definition # define s (a, B) a * BReference S (A + C, B + C)Expand A + C * B + C
Conditional compilation# Define debug // debug
Why do Chinese programmers dare not say no to the C ++ Standards Committee?
I posted a post on csdn, pointing out that it is unreasonable for the c ++ Standards Committee to set the standard mandatory for loop consistency.In fact, the discussion on
Events are an important part of C #. There is a demo of custom events on msdn. After reading it for a long time, I was a little dizzy. So I created a new winform project and added a button to find the program to be called. I made a similar
I. Common strings1. Write the code to find the number of occurrences of the substring in the parent string.
int count(char* str,char* substr){char* str1;char* str2;int num = 0;while(*str!='\0'){str1 = str;str2 = s;while(*str2 == *str1&&(*str2!='\0')&
Experiment on several types of int format operators in Dev-C ++
Kingwei 2005.3.10
Tutorial environment: Dev-C ++ 4.9.6.0 (GCC/mingw32), use the-wall compilation Option
# Include
Int main (){Int v_int;Signed int v_signed_int;Unsigned int
First, you must understand the message transmission mechanism in windows. When a message is active with a mouse, the system sends the wm_nchittest message to the form to determine the message location. If you click the title bar and the message
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