调用a中的函数后,控件返回到哪里

  • 本文关键字:返回 控件 函数 调用 c++
  • 更新时间 :
  • 英文 :

class x{
public:
int A(){
B();//function call
}
int B(){
//print stuff
}

所以我试图弄清楚在调用B((之后,这个程序显示"之后控件返回到哪里;编译时间超过";如果在打印后返回,将控制返回到A((或main((;

Control将返回到A((函数,因为B((有int返回类型,它将返回int值。

class x{
public:
int A(){
val = B();//function call
//If B() was initialised in a variable value of
// Val will become the return value of B()
}
int B(){
//print stuff
// After Print it will go back to A()
}

即使B((没有int返回类型,并且您没有在B((中放入return,在执行B((的所有语句后,程序控制也将始终返回调用函数

如果B((具有void,则控件将始终流回调用函数

最新更新