c++ problem details learning

1 C++ function default parameters
2 Staic function
A in the class class in c++ : Because the this pointer is not passed, static member functions can only access static members and cannot access non-static members.
Reference:
static member function in C++ class
B: static modified members Functions can be public, protect, and private.
Reference:
Can static variables and functions in
c++ be inherited by subclasses ? 3 This
1: this pointer of member functions in c++ is a pointer implicit in non-static member functions
2: this does not need Definition, you can use it directly
3: this pointer points to the object to which the called member function belongs.
Purpose:
1 When a formal parameter and a member variable have the same name, use this to distinguish it.
2 To return the object itself in a non-static member function of a class, you can use it return *this
reference:
the difference between this and *this in C++
4 c++ template
Purpose: Class template, which can define the same operation and have member attributes of different data types.
Note: When the parent class inherited by the class is a template class, the template class needs to be Specify attributes
Refer to
C++ class template and template class
5 Class member functions declared as const,
such as virtual float masterVolume() const;
If the member function is declared as const, the member function is not allowed to modify the data members of the class.
C++ const class member function

Knowledge points

**
1 Detailed explanation of static_cast and dynamic_cast
static_cast can be understood as forced conversion in the c language .

Guess you like

Origin blog.csdn.net/aningxiaoxixi/article/details/111795647