Reference static method along with class name : static « Class « C++






Reference static method along with class name

  
#include <iostream>
using namespace std;
class SomeClass 
{
 public:
   static void message(void) { cout << "Hello, world!\n"; } ;
};

int main(void)
{
   SomeClass::message();
}
  
    
  








Related examples in the same category

1.Static member variables and functions
2.static functions and ID numbers for objects
3.Using a static data member in a class
4.Static member data.
5.Accessing static members without an object.
6.Accessing static members using non-static member functions.
7.Static member functions.
8.static members in classes
9.Calculate salary using static members.
10.static counter
11.Update static field in member method
12.static field is shared among instances