C++ static member function

Objectives :

  • myStaticMemebers1.cpp
    The static members are independent and not attached to any particular object, therefore static members can be used directly using the Class (enclosure) name with scope :: operator.
    • example
      class ABCD { public: static int ShowValue(){ return sal;} };
      int main () {cout<< MyStat::ShowValue(); return 0}
  • The leverages with static members with their uses universally, could be their weaknesses. The class will be exposed
  • Code : myStaticMemebers1.txt
 

Step: 1 Create a source file.

Step: 2 Edit and save Source file

 

Step: 3 Runtime Views:

Step: