Home >Backend Development >C++ >In C/C++, when can I use forward declarations?
In C, a forward declaration lets the code following the declaration know that a class exists It's called "people". When the compiler sees these names used, it is satisfied. Later linkers The class definition will be found.
Class Person; void myFunc(Person p1) { // ... } Class Person { // Class definition here };
So in this case when the compiler encounters myFunc it will know that it will encounter this class somewhere in the code. This can be used in situations where code using the class Place/include before the code containing the class definition.
The above is the detailed content of In C/C++, when can I use forward declarations?. For more information, please follow other related articles on the PHP Chinese website!