When a function is not part of a specific instance and belongs to the entire class, then this function is best written as a static member function, so that it can be called directly with the class name
Class::func ()
For general member functions when using obj. Func () When the function is called, the compiler compiles it to the style of typeof (obj):: Func (), so a static member function cannot be called
Both the friend function and the static member function do not belong to the class and are not passed in when invoked, so you cannot use the
Only allow this class of objects to share data, let member variables be declared static, static data member initialization to be placed outside, Class::name = value, because it belongs to the class, so the allocation of space is defined outside the time of allocation, not when the object definition is allocated
C + + is optimized for anonymous objects and is optimized to create new objects directly without having to establish an intermediate object. The anonymous object compiler can be released as early as possible, and a good compiler can optimize
General single-Mesh: Fanhuizhi operator+ () {}
Special point with dummy Fanhuizhi operator++ (int/* with int for post Plus, no int for front Plus/)
The overload of the type conversion operator Fanhuizhi operator double () {}, because the return value type is the same as the function name, so C + + can allow non-write return value types, plus boolalpha can see the bool type converted to true false, Come on, add Noboolalpha.
C + + static member functions, static member variables, operator overloading