Skip to main content
2 of 2
Fixed small error
PMF
  • 16.1k
  • 4
  • 27
  • 55

The initialization of the static member counter must not be in the header file.

Change the line in the header file to

static int counter;

And add the following line to your employee.cpp:

int Employee::counter = 0;

Reason is that putting such an initialization in the header file would duplicate the initialization code in every place where the header is included.

PMF
  • 16.1k
  • 4
  • 27
  • 55