当前位置:网站首页>[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 .
边栏推荐
- 安全事故等级划分为哪几级
- KAUST:Deyao Zhu | 价值记忆图:基于离线强化学习的图结构世界模型
- Using fastjson to solve the problem of returning an empty array from a null value of a field string object
- How to visit a website
- Transaction verification of btcd transaction process (2)
- La différence entre philosophie et littérature
- [LeetCode]1. Sum of two numbers thirty-four
- [matlab] matrix transformation and matrix evaluation
- String类中split()方法的使用
- 哲學和文學的區別
猜你喜欢

How to control the display and hiding of layergroup through transparency in leaflet

Masa auth - overall design from the user's perspective

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

The PMP examination time in March 2022 is set -- "March 27"

Will the salary increase after obtaining PMP certification?

How to make maputnik, a vector tile matching artifact, support GeoServer

【HCIE论述】STP-A

MySql索引

ik分词器的安装

What are the PMP scores?
随机推荐
中科大USTC:Minrui Wang | 基于Transformer的多智能体强化学习的配电网稳压
JPA execution failed in scheduled task -executing an update/delete query transactionrequiredexception
How to quickly query the mobile phone number home and operator
[LeetCode]1. Sum of two numbers thirty-four
MySql索引
[LeetCode]28. Implement strstr()
Browser cache execution process
[LeetCode]20. Valid parentheses thirty-six
Conversion of integer part and decimal part between binary / octal / decimal / hexadecimal
电商员工离职后将产品价格改为1折出售,已被刑拘
Converting Chinese numbers to Arabic numbers in Delphi
Handling method of wrong heading of VAT special invoice
How to gracefully solve the offset problem of Baidu and Gaode maps in leaflet
The whole process from entering URL to displaying page (interview)
Daily buckle exercise - conclusion
新增博客地址
Matlab [path planning] - UAV drug distribution route optimization
[matlab] basic operation
Distributed lock implementation
63. different paths II