|
「メンバ初期化子は、コンストラクタでしか記述できない」
ですね、わかりました。
class CHogeClass : public CFooClass
{
int a;
const int b;
public:
CHogeClass(HWND hWndParent = NULL) : CFooClass(hWndParent), a(0), b(100)
{
}
};
の場合、コンストラクタが実行される前に
CFooClass = hWndParent; (意味がわかってません)
a = 0;
b = 100;
が実行されるという認識でよろしいのでしょうか。
class CHogeClass : public CFooClass
{
const int a = 0;
const int b = 100;
public:
CHogeClass(HWND hWndParent = NULL) : CFooClass(hWndParent)
{
}
};
と
class CHogeClass : public CFooClass
{
int a;
const int b;
public:
CHogeClass(HWND hWndParent = NULL) : CFooClass(hWndParent), a(0), b(100)
{
}
};
を比べた場合の、メンバ初期化子の利点を知りたいのですが
|