How to implement static members and static functions in correct manner ?

How to implement static members and static functions in a .hpp and .cpp file to work properly ?

Thanks in advance
Martin
martinmoessnerAsked:
Who is Participating?
 
AxterConnect With a Mentor Commented:
Hi martinmoessner,
Example code:

//In your header file (*.hpp)
class foo
{
  static int DataMember;
  static void MemberFunc();
};

//In your *.cpp file

#include "foo.h"

int foo::DataMember = 123;

void foo::MemberFunc()
{
  //Your function code here
}

David Maisonave :-)
Cheers!
0
 
AxterCommented:
Why the B grade?
0
All Courses

From novice to tech pro — start learning today.