Class name does not name a type in C++

前端 未结 10 1961
情深已故
情深已故 2020-12-08 09:37

I just started programming in C++, and I\'ve tried to create 2 classes where one will contain the other.

File A.h:

#ifndef _A_h
#define          


        
10条回答
  •  -上瘾入骨i
    2020-12-08 10:02

    The problem is that you need to include B.h in your A.h file. The problem is that in the definition of A, the compiler still doesn't know what B is. You should include all the definitions of all the types you are using.

提交回复
热议问题