This also happens on msdev c++ compiler:
class Dummy
{
private:
static int instances; // current number of Dummy objects i
int value; //..snip..
public:
// inspector methods
static int getInstanceCount(void) const
{
return Dummy::instances;
}
int getValue() const { return value; }
//..snip..
Dummy() { instances++; }
~Dummy() { instances--; }
};
Either remove the static before the getInstanceCount or the const after it will make it compile. I think the issue is to do with the const since a static function doesn't have a this pointer (as mentioned above?).
I've asked a guy here at work who is a c++ boffin, I'll let you know what his reply is.
[edit] his reply is this:
the static modifier on a class member function means that no data within the current object is modified by this function. As the static member function (and the static member variable you're accessing with it) doesn't belong to any object, the const modifier doesn't apply. Hence, you can't use it so just leave it off.
[/edit]