I have the following code:
IFile.h
class IFile
{
public:
IFile();
~IFile(void);
inline bool IsValidFileType() const;
};
IFile.cpp
IFile::IFile()
{
//IsValidFileType();
}
IFile::~IFile(void)
{
}
inline bool IFile::IsValidFileType() const
{
return true;
}
main.cpp
int main(int argc, char* argv[])
{
IFile* pFile = new IFile();
pFile->IsValidFileType();
return 0;
}
When compiling the code I get the following error: error LNK2019: unresolved external symbol "public: bool __thiscall IFile::IsValidFileType(void)const " (?IsValidFileType@IFile@@QBE_NXZ) referenced in function _main
If I change wither "inline" or "const" qualiferes for the function, or call it inside the constructor, the program will complile. Can you please explain this behaviour?