-2
私はC++をどのようにフォーマットするかを学んでいますので、できるだけクリーンで何かを理解することはできません。関数固有のconstオプション/変数を格納する正しい方法?
関数固有の定数変数を保存するにはどうすればよいですか?
私の最初のアイデア::.cppファイル内の
:
// ---------------------------------------------------------
// Purpose: Drawing the menu background.
// ---------------------------------------------------------
inline void DrawBackground() {
static int BeginWidth = 80;
static int EndWidth = 590;
//usage of the BeginWidth and EndWidth
}
私の第二のアイデア:.hの内部
:
は、私は、次の2つのアイデアを持っていますconst int BeginWidth = 80;
const int EndWidth = 590;
た.cpp:
// ---------------------------------------------------------
// Purpose: Drawing the menu background.
// ---------------------------------------------------------
inline void DrawBackground() {
//usage of the BeginWidth and EndWidth
}
これらのアイデアのいずれかが正しいですか?両者が正しい場合は、より適切と考えられるのでしょうか?