C++-类与对象总结

const函数声明

  1. 修饰成员函数,不会改变成员变量:
  • a function b const (c){}: in member function means, all member properties in the function cannot be modified.

2.修饰形参,输入参数在函数中不会被更改,提高程序的健壮性:

  • a function b (const c){}: the parameter c cannot be modified in the function
  1. 修饰返回值,返回值不能修改,尤其用在返回值是指针类型的时候:
  • const a function b (c){}: the return value a cannot be modified in the function
相关推荐
灵哎惹,凌沃敏几秒前
C语言/Keil的register修饰符
c语言·开发语言
pobu16826 分钟前
aksk前端签名实现
java·前端·javascript
Azxcc030 分钟前
C++迭代器失效
开发语言·c++
0wioiw036 分钟前
Flutter基础(前端教程⑤-组件重叠)
开发语言·前端·javascript
冰天糖葫芦1 小时前
VUE实现数字翻牌效果
前端·javascript·vue.js
Brilliant Nemo1 小时前
集成CommitLInt+ESLint+Prettier+StyleLint+LintStaged
javascript
嘉琪0011 小时前
2025 js——面试题(7)——ajax相关
开发语言·javascript·ajax
SoniaChen331 小时前
Rust基础-part3-函数
开发语言·后端·rust