Jak*_*les 2 c++ documentation doxygen
关于C++中const和非const方法之间的区别,我有几个问题.
例:
MyObject* MyClass::objectReference()
const MyObject* MyClass::objectReference() const
Run Code Online (Sandbox Code Playgroud)
我的问题是:
我不知道doxygen; 虽然这是我所知道的.
const版本,则无法在const对象上调用它.const版本,则可以在const非const对象和非对象上调用它.const则将在非const对象上调用非版本,并且const将在const对象上调用该版本.const对象,则必须将对象转换为自身的const引用:static_cast<const MyClass&>(myObject).objectReference();| 归档时间: |
|
| 查看次数: |
693 次 |
| 最近记录: |