我讀過很多關於前向聲明的文章,但我仍然有一個問題。 讓我們假設有: // File a.hpp (in this question I avoid writing guards in header files, for the sake of simplicity)
class A
{
// Class B is used only by pointer, the compiler
我有一個名爲S的結構體和一個指向結構體S的名爲A的指針數組。我的函數T將一個指向結構體S的指針作爲參數。 struct S *A; //forward declare array A of (pointers to) structs
...
void T(struct S *s){//function that accepts pointer to struct S
...
}