最近私はクラスを作成しましたSquare
:
=========ヘッダーファイル======
class Square
{
int m_row;
int m_col;
public:
Square(int row, int col): m_row(row), m_col(col)
};
==========cppファイル======
#include "Square.h"
Square::Square(int row, int col)
{
cout << "TEST";
}
しかし、それから私はたくさんのエラーを受け取ります。cppファイルを削除し、ヘッダーファイルを次のように変更した場合:
=========ヘッダーファイル======
class Square
{
int m_row;
int m_col;
public:
Square(int row, int col): m_row(row), m_col(col) {};
};
エラーなしで準拠します。初期化リストをヘッダーファイルに含める必要があるということですか?