I have a class in header file:
class Employee
{
//Private data members
private:
string firstName;
string lastName;
char gender;
//number of employees
const static int numEmployees = 0;
public:
....
};
The dumb thing is in "GUIDELINE" from instructor said that declare numEmployees as a static integer value of 0 in private member of class
Problem is I can't update numEmployees
variable since it's const
, for example when you declare Constructor in public: .. you can not increase numEmployees = numEmployees + 1
.
If you don't declare numEmployees
as const
, just do static int numEmployees;
visual studio 2010 give error said that only const
will be declared in class.
Any idea how to declare numEmployees
? Thank you!