I have a question about which function is chosen to init a static class member.
//Base.h
class Base
{
private:
static int count;
static int countInit()
{
return 10;
}
public:
Base()
{
}
};
//and Base.cpp
static int countInit()
{
return 0;
}
int Base::count=countInit();//member function is used.
static int local_count=countInit();//the local one in Base.cpp
The variable Base::count
is initialized with Base::countInit()
rather than the countInit()
defined in Base.cpp. But the local_count
is initialized by the local countInit
. So, I wonder, is there a rule like Koenig lookup within this case?