Tagged: static member functions

Static Member Functions of Class in Cpp 0

Static Member Functions of Class in C++

Like static member variable, we can also have static member functions in a class. A member function that is declared static has the following properties: A static member function can have access to only other static members (functions or variables) declared in the same class A static member function can be called using the class name (instead of its objects) as follows: class-name :: function-name; Program below illustrates the implementation of these characteristics: #include <iostream.h> class test { private: int code; static int count; //static member variable public: void setcode() { code = ++count; } void showcode() { cout <<...