在函数的最后一行放入还是不放回头有什么不同吗?
void InputClass::KeyDown(unsigned int input)
{
// If a key is pressed then save that state in the key array
m_keys[input] = true;
return;
}
Run Code Online (Sandbox Code Playgroud)
use*_*963 11
不,没有区别!
返回的void函数用于早期在一定条件下退出.
例如:
void f(bool cond)
{
// do stuff here
if(cond)
return;
// do other stuff
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
523 次 |
| 最近记录: |