Skip to main content
Fixed small error
Source Link
PMF
  • 16k
  • 4
  • 26
  • 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.

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:

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.

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.

Source Link
PMF
  • 16k
  • 4
  • 26
  • 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:

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.