I'm working on this program and is such a slow progress, I keep stumbling on so small things... Like this one. My textbook is showing a class with private static int, and a public static method which is also const as it just displays the private member... I declared my own class, following the guidelines from the textbook and when I compile it (DevC++ 4.9.9.2) it tells me 34 C:\Dev-Cpp\inheritance_project\main.cpp static member function `static int MyString::numStrings()' cannot have `const' method qualifier
Why is that?
I wrote it as such:
Code:
private:
static int counter;
public:
static int numStrings(void) const { return counter; }
What's wrong then???