静的クラス メンバーを初期化するためにどの関数を選択するかについて質問があります。
//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
変数は、Base.cpp で定義されたものではなく、でBase::count
初期化されます。しかし、はローカルによって初期化されます。では、この場合、 Koenig ルックアップのようなルールがあるのだろうか?Base::countInit()
countInit()
local_count
countInit