C&C++ 函数设计 #8
JAX1024Dev
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
函数接口的两要素:参数和返回值。传递方式如下:
在 C 中,有两种:pass by value, pass by pointer。
在 C++ 中,增加了一种:pass by reference。
参数规则
const &方式来传递。这样可以省去临时对象的构造和析构过程,提高效率。返回值规则
引用与指针的比较
引用的一些规则:
Beta Was this translation helpful? Give feedback.
All reactions