If we create a member function of a class as static it is called a Static member function in c++.

Static Member function used only static data members.

It is also accessible if we do not have any object of a class. we can access static member functions using class name and scope resolution operator (: : ).

Static member function it is not part of any object, it is called using the classname.

static member function in c++
class class_name{
    static function_name();
}
class_name : : function_name();

class_name: class name is the name of a class.

function_name: function name is the name of a static function.

Example :

#include<iostream>
#include<conio.h>
using namespace std;
class item {            
  static int count;
  int code;
  public:
  void setcode(void)
  {
     code = ++count;
  }
  void showcode(void)
  {
     cout<<"object number is = "<<code<<"n";
  }
  static void showcount (void)
  {
     cout<<"count is = "<< count<<"n";
  }
};
   int item :: count=8;
main(){
   item obj1,obj2;
   obj1.setcode();
   obj2.setcode();
   item :: showcount();
   item obj3;
   obj3.setcode();
   item :: showcount();
   obj1.showcode();
   obj2.showcode();
   obj3.showcode();
   getch();
   return(0);
}

output :

count is = 10 count is = 11 object number is = 9 object number is = 10 object number is = 11