Some interesting facts about static member functions in C++ Last Updated : 30 Oct, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 1) static member functions do not have this pointer. For example following program fails in compilation with error "`this' is unavailable for static member functions " CPP #include<iostream> class Test { static Test * fun() { return this; // compiler error } }; int main() { getchar(); return 0; } 2) A static member function cannot be virtual (See this G-Fact)3) Member function declarations with the same name and the name parameter-type-list cannot be overloaded if any of them is a static member function declaration. For example, following program fails in compilation with error "'void Test::fun()' and `static void Test::fun()' cannot be overloaded " CPP #include<iostream> class Test { static void fun() {} void fun() {} // compiler error }; int main() { getchar(); return 0; } 4) A static member function can not be declared const, volatile, or const volatile. For example, following program fails in compilation with error "static member function `static void Test::fun()' cannot have `const' method qualifier " CPP #include<iostream> class Test { static void fun() const { // compiler error return; } }; int main() { getchar(); return 0; } References: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf Comment More infoAdvertise with us Next Article Some interesting facts about static member functions in C++ K kartik Follow Improve Article Tags : C++ C++-Static Keyword Static Keyword Practice Tags : CPP Similar Reads Static Member Function in C++ The static keyword is used with a variable to make the memory of the variable static once a static variable is declared its memory can't be changed. To know more about static keywords refer to the article static Keyword in C++. Static Member in C++ Static members of a class are not associated with t 4 min read Memory Allocation in Static Data Members in C++ C++ allows defining static data members within a class using the static keyword. When a data member is declared as static, then we must keep the following note in mind: Irrespective of the number of objects created, only a single copy of the static member is created in memory. All objects of a class 4 min read std::is_member_function_pointer template in C++ with Examples The std::is_member_function_pointer template of C++ STL is present in the <type_traits> header file. The std::is_member_function_pointer template of C++ STL is used to check whether the T is a pointer to non-static member function or not. It return the boolean value true if T is pointer to non 2 min read Functions that cannot be overloaded in C++ In C++, following function declarations cannot be overloaded. 1) Function declarations that differ only in the return type. For example, the following program fails in compilation. CPP #include<iostream> int foo() { return 10; } char foo() { return 'a'; } int main() { char x = foo(); getchar() 3 min read Const member functions in C++ Constant member functions are those functions that are denied permission to change the values of the data members of their class. To make a member function constant, the keyword const is appended to the function prototype and also to the function definition header.Like member functions and member fu 5 min read Like