当前位置:网站首页>[error] invalid use of incomplete type uses an undefined type
[error] invalid use of incomplete type uses an undefined type
2022-06-13 00:28:00 【SZU healing system bug】
Today, when writing about Altman's fight against the monster , Find a strange problem , I have defined two base classes Ultraman and Monster, One Monster Subclasses of Boss, Then the two base classes have collusion with each other , They all use each other's type to define themselves more or less , Then I declare another class before the first class implementation :

After compiling, an error is reported :

Then it says you can't use incomplete class types :
![]()
I began to feel confused , Clearly my two classes are well defined , How can I say that I have no definition . I also stated above .
Then after two hours of searching by me and another senior in junior year , All kinds of investigation , Finally realized a problem :
Because these two classes are colluding with each other , So when one class uses another class for object instantiation , Another class will also find this class object to instantiate , And they have not been defined yet , In a nutshell , I need you to do something for me A, But you want to do something A Need me to do something B, And I do things B It must be based on you doing things for me A Under the premise of .
So I found a solution :
Class definition and class implementation are separated .
Class implementation is written after two class definitions .
done .
边栏推荐
- 【HCIE论述】STP-A
- On the usage details and special usage of switch case
- 【HCIE论述】RR-A
- How to quickly query the online status of mobile phones
- Matlab [path planning] - UAV drug distribution route optimization
- [matlab] 3D curve and 3D surface
- [CISCN2019 华北赛区 Day2 Web1]Hack World --BUUCTF
- 63. different paths II
- Kaust:deyao Zhu | value memory map: a graph structured world model based on off-line reinforcement learning
- Test platform series (97) perfect the case part
猜你喜欢

RCC clock configuration of stm32f401

JPA execution failed in scheduled task -executing an update/delete query transactionrequiredexception

3、 Storage system

PMP test difficulty and pass rate

Why study PMP?

Maya modeling VI

Explain bio, NiO, AIO in detail

MASA Auth - 从用户的角度看整体设计

String类中split()方法的使用

Stm32f4 development of DMA transmission to GPIO port
随机推荐
Learn to divide subnets in an article
New blog address
Information collection for network security (2)
Explain bio, NiO, AIO in detail
[LeetCode]20. Valid parentheses thirty-six
[hcie discussion] multicast igmp-a
中科大USTC:Minrui Wang | 基于Transformer的多智能体强化学习的配电网稳压
Installation of IK word breaker
Stm32f4 development of DMA transmission to GPIO port
[matlab] matrix
如何快速查询手机在网状态
June 11, 2022 diary: Mr. Wang's spring, mixed in
Context of go concurrency mode
Generate two-dimensional code in Delphi
Matlab [path planning] - UAV drug distribution route optimization
TypeError: wave.ensureState is not a function
6.824 Lab 4B: Sharded Key/Value Service
[matlab] polynomial calculation
Maya modeling VI
Ad14 component pin name disappeared