Differences
In C ++, for the class, it is obtained by the vertex operator,
For a pointer to a Class Object, use the arrow operator-> to call the member of the object to which the Pointer Points.
After the class definition> overload operator,
Generic constraints mean: the generic type of a class can only be the interface or class written after the WHERE clause.It seems a little hard to understand. For example.I have an interface, as shown below:
CopyCode The Code is as follows :///
///
Note: If the debugging mode is not enabled, the default debugging window is as follows:
Preparations before start:
Create the console program DebugWindowDemo:
Modify the code of Program. cs:
Copy codeThe Code is as follows: using System;
Using
The following is the source code of c ++:
Copy codeThe Code is as follows: class X {
Public:
Int I;
Int j;
~ X (){}
};Void f (X x ){X x1;X. I = 1;X. j = 2;
}Int main (){F (X ());}
The following is the assembly code of the main function:Copy codeThe
In c ++, if no destructor is provided for a class, the compiler will provide the default destructor for this class. Because the function of the Destructor is opposite to that of the constructor, the compiler also provides useless default constructor
1. cin2. cin. get ()3. cin. getline ()4. getline ()5. gets ()6. getchar ()
Appendix: cin. ignore (); cin. get () // skip a character, for example, do not want to press enter, space, and other characters
1. cin>
Usage 1: the most basic and common
An ordered container aggregates a single type of elements into a container and stores and accesses these elements based on their locations. This is an ordered container. The standard library defines three types: vector (supports fast random access),
Case 1: as shown in the following figure, n output is 100. Although the two-layer cyclic identifiers are all I, the two do not have different jurisdictions. The specific situation is unknown ~~~ Please explain
Copy codeThe Code is as follows: int
Gaussian distribution is also known as normal distribution)
The common mature method for generating Gaussian distributed random number sequences was proposed by Marsaglia and Bray in 1964. The C ++ version is as follows:
Copy codeThe Code is as
[Problem] combination Problem
Problem description: Find all the combinations of the numbers of r from natural numbers 1, 2,..., and n. For example, all combinations of n = 5 and r = 3 are:
1, 2, 31, 2, 41, 3, 42, 3, 41, 2, 51, 3, 52, 3, 51, 4, 52, 4,
The first is to reference the c ++ source code:
Copy codeThe Code is as follows: void add (int a, int B, int & c ){
C = a + B;
}
Int main (){Int a = 1;Int B = 2;Int c = 0;Add (a, B, c );
}
The following is the assembly code corresponding to
We all know how to calculate matrix multiplication. Generally,We all use the following code.:
Copy codeThe Code is as follows: for (I = 0; I For (j = 0; j Sum = 0;
For (k = 0; k Sum + = A [I] [k] * B [k] [j];
C [I] [j] + = sum;
}
However, there is
With the previous foundation, this article only records some things that have not been noticed before and are worth learning.
Chapter 1
The author thinks that using # if 0... # endif is better than using/* and */, because the latter cannot be nested.
A regular expression is an important way to describe a word. Although regular expressions cannot express all possible patterns (for example, "a string composed of equal numbers a and B "), however, it can efficiently describe the pattern type used
Generally, C # uses XML-based configuration files. However, if necessary, for example, to take into account the old system, the INI file may still be used.However, C # itself does not have an API for reading and writing INI files. Only by calling
It is implemented by calling Win32 API.
Copy codeThe Code is as follows: public class User32API
{
Private static Hashtable processWnd = null;
Public delegate bool WNDENUMPROC (IntPtr hwnd, uint lParam );
Static User32API (){If (processWnd =
BackgroundWith the prevalence of rich client frameworks and numerous excellent front-end js frameworks, we may encounter cross-origin problems in many cases, while JavaScript ajax requests do not allow direct cross-origin access, of course, you may
Partial Class is introduced in C #2.0, and Partial Method is introduced in C #3.0. These two syntax features share the same characteristics) the method code is scattered in multiple places.
1. features and applications of the Division class
1.1
C # How to reasonably release the unmanaged memory? In this article, we will explain how to use IDisposable to release hosted and unmanaged memory.
A.First, let the class implement the IDisposable interface, and then implement the IDispose method.
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