頭文件互相包含
當class A頭文件已經#include "B.h",而此時class B中又想使用A 類;怎麼辦?
解決方法:
先聲明類A,再定義對象指針,在其源文件中include,即可使用;
B.h中:
class A ;
class B : public CDialog
{
A *a;
}
在B.cpp中
#include "A.h"
即可使用;
可能會出現某標識符找不到,此時只需在stdafx.h中#include "resource.h"即可