These days looking at the C + + object model in depth, see a sentence: Static member functions can not be constant functions, the following code:
Class Test {
virtual ~test ();
Public:
static void Statest ();
If Statest () is modified to: static void Statest () const;
Compile return error in VS2015: ' statest ': modifiers not allowed on static member functions.
The root causes are:
1. The const member function means that in the body of the function, the member variable of the class object is not allowed to be modified, which is to say that the this pointer of the member function is const* in the const member function, that is, a pointer constant that does not allow the pointer to modify what the pointer points to.
2. Again, the meaning of the static member function is that the member function belongs to the entire class, not to a particular class instance, and, more bluntly, does not require the this pointer (a member function called by a class instance to be converted to the this pointer into a member function).
The reason for this is obvious, because these two keywords are conflicting, and in a function without this pointer, it is completely meaningless to attempt to specify the constants of this pointer.
The daily product Bujikuibu, even thousands of miles.