References and LoadBitmap several easily confusing issues

zhaozj2021-02-16  50

1: INT & ABC (); What role is in the function?

INT x = 0;

INT & A (INT & I)

{

i = - 1 ;.

Return X;

}

Main ()

{

INT j = 10;

A (j) = 100;

// At this time j = -1, x = 100.

}

That is, if it returns a reference, it is to return a variable address, which is really returning to this variable itself, which can be used as the left value to change the value of the returned reference variable, J After entering the function, functions J is a variable, the return value and X are a variable, so after the assignment, the value of X after the value is changed, and this method is often used in the operator overload = number, so master this knowledge Still there is also a need for DI.

2: CBitmap :: loadbitmap (lpctstr lpszresourceEName "What does the parameter mean?

First look at an example:

CBitmap Bitmap;

BitMap.LoadBitmap (MakeintResource (IDB_bitmap1));

The definition of makeintResource is ((DWORD) ((Word) ((Word))) Transfers the ID to the Unsigned Short Int to convert to unsigned long and then force to convert to strings. This LPCTSTR parameter is not a file name, just a forced transformation of a resource ID.

3: CLIST and CLIST What is the difference?

"Plus & main is to improve the efficiency when large objects is parameter"

For a large object, if the parameters are passed in a pass value, the entire object is to be copied, it may spend a lot of time, so Clist can customize the parameter type it accepts, which solves the above problem.

The two do not have any difference in behavioral performance, which is different from the use of parameters.

转载请注明原文地址:https://www.9cbs.com/read-22838.html

New Post(0)