I have a class in the header file:
class Employee
{
private:
string firstName;
string lastName;
char gender;
const static int numEmployees = 0;
public:
....
};
The dumb case in "GUIDELINE" from the instructor says that declaring numEmployees as a static integer value 0 in a private member of the class
The problem is that I can’t update the variable numEmployees, since it const, for example, when you declare the constructor publicly: .. you cannot increase numEmployees = numEmployees + 1.
If you do not declare numEmployeeshow const, just make a static int numEmployees;visual studio 2010, report an error, inform that only the class constwill be declared in the class.
Any idea how to declare numEmployees? Thank!
source
share