在C++中使用未定义的函数

The*_*ien 2 c++ function

如何在我的C++程序中使用未定义的function2?函数2稍后定义,但我需要在function1中使用function2.但是,function2也需要function1才能工作!我该怎么做呢?

function1(){...function2()...}
function2(){...function1()...}
Run Code Online (Sandbox Code Playgroud)

这样的事情.

Pot*_*ter 5

使用前瞻声明:

void function2();
Run Code Online (Sandbox Code Playgroud)

这指定了接口function2(无返回值,无参数),以便function1可以调用它.