Some interesting facts about static member functions in C++ Last Updated : 23 Jul, 2025 Comments Improve Suggest changes 54 Likes 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: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf Create Quiz Comment K kartik Follow 54 Improve K kartik Follow 54 Improve Article Tags : C++ C++-Static Keyword Static Keyword Explore C++ BasicsIntroduction to C++3 min readData Types in C++6 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++3 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++12 min readFile Handling in C++8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++6 min readPolymorphism in C++5 min readEncapsulation in C++3 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL2 min readIterators in C++ STL10 min readC++ STL Algorithm Library3 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like