Static function

Static function is used to access static data members of a class.Static function is called using class name and scope resolution operator. We do not need an object to call static function. //Header fileclass singleton {    static singleton* m_instance;    singleton() {}    singleton& operator=(const singleton& );    singleton(const singleton& );     public:    ~singleton() {}    static singleton* getInstance(); }; //Source file singleton* singleton::m_instance = NULL;singleton* singleton::getInstance() {  //static function accessing static data member m_instance    if (NULL == m_instance) {        return new singleton;  …