C ++ learning and learning
Machine language = process-oriented = object-oriented.
Overload: The function name is the same, and the parameters are different (type, number );
Overload is not an object-oriented feature, but a solution to simplify programming interoperability;
Note: be cautious about function (method) overloading, and pay attention to operator overloading and overwriting;
Complex data types:
Array, pointer, structure, Class
Array: stores values of the same type in the same variable name. It still needs to be declared as a specific type: float, char, int ----
Note: in C language, we generally store strings in a character array, but in C ++, we generally use a string object.
Alignment: The 32-bit system is 4 bytes, And the 64-bit system is 8 bytes. Memory alignment and file alignment.
The pointer is the type * pointerName variable used to store the address. Therefore, you can place the address in the pointer variable.
Asterisk usage: the first is used to create a pointer, and the second is to unreference the pointer.
C ++ supports the void * vPpinter without a type pointer. You must first convert it to an appropriate data type before resolving the reference.
Pointers and arrays:
The array name is the first address of the array.
Thoughts:
# Include <iostream> using namespace std; int main () {const unsigned short ITEM = 5; int intArray [ITEM] = {1, 2, 3, 4, 5 }; char charArray [ITEM] = {'A', 's', 'D', 'F', 'G'}; int * intPtr = intArray; char * charPtr = charArray; cout <"integer" <endl; for (int I = 0; I <ITEM; I ++) {cout <* intPtr <"at" <reinterpret_cast <unsigned long> (intPtr) <endl; intPtr ++ ;}for (int I = 0; I <ITEM; I ++) {cout <* intPtr <"at" <intPtr <endl; intPtr ++ ;} cout <"optimized" <endl; for (int I = 0; I <ITEM; I ++) {cout <* charPtr <"at" <reinterpret_cast <unsigned long> (charPtr) <endl; charPtr ++ ;}for (int I = 0; I <ITEM; I ++) {cout <* charPtr <"at" <charPtr <endl; charPtr ++;} return 0 ;}
There is a difference between the output result of character and integer: The Impact of reinterpret_cast <unsigned long> ()
?