String
First, introduce a few commonly used functions:
Compare (STR1,STR2)--Compare the size of the two string str1,str2, if greater than the return positive number, equal to return 0, less than return negative!
indexof--the position of the first occurrence of a given string in a positional stringPadLeft and padright--fills the string with the specified characters at the beginning and end of the stringToLower and ToUpper convert strings to lowercase or uppercasetrim--Delete End to end blankstrin
You can use the same class template to create a set of objects of any type. In traditional C ++, there may be a floating point class or an integer class. If you use a class template, you can define a class number that applies to b
The usage method is simple. You only need to call the corresponding method of the instantiation class, and then process the method based on the returned value!
Mygsm GSM = new mygsm ("com3", 9600 );
Call: GSM. Call ("15000450819 ");
SMS: listbox1.items. Add (GSM. sendmsg ("15000450819", "I will send another SMS csabcd !, Haha! "). Tostring ());
Obtain the mobile phone machine code: listbox1.items. Add ("machine code:" + GSM. getmachineno ());
//the static keyword in the class template#include using namespacestd;/*The class template is essentially a C + + compiler that creates different classes based on the type parameters, C + + The compiler generates a static variable for each class when the
* next;Static Student * point;};Student: Student (char * name){Strcpy (Student: name, name );This-> next = point;Point = this;}Student ::~ Student () // The Node detachment process{Cout If (point = this){Point = this-> next;Cin. get ();Return;}For (Student * ps = point; ps = ps-> next){If (ps-> next = this){Cout Ps-> next = next; // = next can also be written as this-> next;Cin. get ();Return;}}Cin. get ();}Student * Student: point = NULL;Void main (){Student *
The struct of C + + can be used as class, and the only difference between him and class in C + + is that
the Member in class is private by default, and the struct member defaults to public.
c struct can only be a collection of v
-oriented programs are written under the OO programming banner.
Why should I use static fields and static methods in the class. Why should I put static fields, methods, non-static fields, and methods in a class together? This is a question .?
I know that one application scenario is the singleton mode? Are there other application scenarios?Summary of static methods and application scenarios of static fields:
and support formatting or non-formatting of the buffer input/output of streambuf.Strstreambuf: stores character sequences with strings. Extended Management of streambuf's buffer extraction and insertionFilebuf: stores character sequences using files. Including opening files, reading/writing, and searching characters
For example:
C ++ defines four class objects for standard I/O operations: Cin, cout, cerr
Today, I saw an article titled "objective-c" in the garden.
2.0 with cocoa Foundation --- 5, class type, selector and function pointer ", I have made a wonderful speech and can't help but put it
Code Add notes here for future viewing. My personal experience: the "class type variable" in obj-C is more flexible than the
is a window in C # A class, or an instance of a window class?For:No one is talking about the point.A window, it is not just a class can be described;First, the type of data type for this window is derived from the form class, meaning that it is defined as a class.However, th
A regular expression can be viewed as a small programming language with a specific function that locates substrings in a paragraph of text. Regular expressions allow you to quickly parse large amounts of text to find specific character patterns, extract, edit, replace, or delete text substrings, or add extracted strings to the collection. The basic syntax for regular expressions can be seen in simple, regular expressions (i), and in the regular expression of the English language (II.).
The
normal function pointer: "Return_type (*ptr_name) (para_types)"Class member function pointer: "Return_type (class_name::* ptr_name) (para_types)"Class data member pointer: "type class_name::* ptr_name";C + +:1 classDemo2 {3 Public:4Demo ():d ATA ( -)5 {6 7 }8 intdata;9 intShowintAintb)Ten { One returnA +b; A } - }; - the - - in
between 0~x. Once you have a random number, you can use it as an index to the card object in the temporary array to copy the cards in the cards array.To record the assigned poker, we also have an array of bool variables, specifying the values in the array as true when each card is copied. When generating a random number, check the array to see if a card has been copied to the location specified by the random number in the temporary array, and if so, another random number will be generated.This
According to section 16.4 of the third edition of C ++ primer, the C ++ class template can be divided into the following situations:1. Non-template friends or friends functions. Here is an example:Class Foo {Void bar ();};Template Class queueitem {Friend class foobar;Friend
; - //derived class objects can be assigned or initialized to a reference to a base class object Wu //However, you cannot call a data member of a subclass, at which point the base class reference is not an alias for the derived class object, nor does it share the same storage unit with the derived
Should a defect in the C ++ design be submitted to the C ++ Standards Committee? -- You do not need to force a class common member function to declare it in the class body.
Ordinary member functions of the class must be declared in the
Register_all_custom_pet () global function to complete the registration of the C + + binding class, complete the member properties in the class and "inject" the member function into LUA, " register_all_custom_pet () " function we'll use in a minute. Check that the "Pet" class file we created in the third chapt
VS2010 C # How to make a class DLL and use this class from another project 2011-10-20 486 people read reviews (0) favorite reports First, the class is made into a DLLMethod One: You can make the Xxx.cs file directly into a DLL file by using a command at the command lineMethod two: Through Visual studio2010Create a
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.