Iterator: Enumerator
If you are creating a class that behaves and behaves like a collection, it is convenient to allow users of the class to enumerate the members of the collection using a foreach statement. This is easier to implement in C # 2.0
A conversion operation is a substitutability operation between a class of equal-generation types. A generational type means that a class can replace another class. This may be a good thing: an object of a derived class can be replaced by an object
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
In C #, I believe you are not unfamiliar with "value type" because it is indispensable in our code design, so what is "value type"? "Value type" is the Int16,int32 these numeric types we use?
We know that all types in C # inherit from the
Intention
Define a series of algorithms, encapsulate them one by one, and make them interchangeable with each other. This mode allows the algorithm to change independently of its customers.
Scene
When developing a program, we often take different
According to the horse Soldier Teacher Chat Room program optimization, while increasing the interaction between the chat.
At the same time, increasing the server will add an interactive window for each client, so that servers can interact with each
A canonical class declaration defines a new reference type. A class can inherit from another class and can implement multiple interfaces.
Class members can include: constants, fields, methods, properties, events, indexers, operators, instance
Xml
An XML file (Bookstore.xml) is known as follows:
oberon ' s legacycorets, eva5.95
1. Insert a node into the node:
XmlDocument xmldoc=new XmlDocument ();Xmldoc.load ("Bookstore.xml");XmlNode Root=xmldoc.selectsinglenode ("bookstore");//Find
The first is struct, in C + +, the structure actually and class have very much similarity. But one difference is that struct is public by default, and class is private.
Of course, the use of struct inheritance is also possible.
The common body is
1. If the function is not declared, it should be defined before the call:
#include /* 定义求大值函数 */ int MAX(int x, int y) { if (x > y) return x; else return y; } /* 定义求小值函数 */ int MIN(int x, int y) { return x } int main(void) {
In a structure, the data type of each field is unique; Using unions, you can store different data types in one field.
Different data types share a piece of memory. Of course, its memory size should be based on the big.
The data in the joint,
1. Variable addresses can be obtained through & variables:
#include int main(void) { int num = 10; printf("变量值: %d\n",num); printf("变量址: %d\n",&num); getchar(); return 0; }
2. A variable that represents a variable address is a
The return value of a function template can also be defined as a template parameter (template parameter), but because it cannot be inferred (deduce), an explicit (explicit) designation is required;
Since the explicitly specified order is
1. General:
#include int main(void) { int i; for (i = 0; i switch (i) { case 1: printf("%d\n", i); break; case 3: printf("%d\n", i); break; case 5: printf("%d\n", i);
3.if...elseif statement
The actual application often faces more choice, at this time, will If...else expands, then obtains the IF...ELSEIF structure, its general form is:
if
statement 1
else if
statement 2
else if
The basic operation of two-way linked lists:1, findIf we were to find a node in a bidirectional cyclic list with a header that has a specific value for the data field, we also compare the values of each node data field from the header node, and if
Class and Object oriented:
Display interface (explicit interface): that is, visible in the source code, you can see all the interfaces of the class in the header file;
Run-time polymorphism (Runtime polymorphism): A member function is virtual,
Directory
Native enumerations and managed enumerations
A single class solution
Five class Solutions
Six class Solutions
After introducing the "from C + + to. NET" Theme in June 2006, I started writing a series of columns to delve into how to
UML for many people should not be a strange concept, the past two years, the UML has been more and more discussion. It seems that the subject of UML and I do not seem to have much of a relationship (it is language-independent, even if it is in
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