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
相关推荐
JieE2127 小时前
LeetCode 226. 翻转二叉树|JS 递归超详细拆解,二叉树入门经典题
javascript·算法
JieE2127 小时前
LeetCode 104. 二叉树的最大深度|递归思路超详细拆解
javascript·算法
kyriewen11 小时前
我用 AI 一周写完了整个项目,上线第一天就崩了——这是我踩过最贵的 5 个坑
前端·javascript·ai编程
Larcher12 小时前
AI Loop:让AI像人一样自主完成任务的核心机制
javascript·人工智能·设计模式
默_笙12 小时前
🃏 JS 只有 8 种数据类型,但我花了 2 天才搞懂 null 和 undefined 的区别
javascript
jump_jump12 小时前
流式 HTML:从 htmx 片段装配到浏览器原生增量渲染
javascript·性能优化·前端工程化
swipe14 小时前
正则表达式入门到进阶:从表单校验到手写模板引擎
前端·javascript·面试
kyriewen14 小时前
前端错误监控最全指南:捕获 JS 异常、Promise 拒绝、资源加载失败,附上报代码
前端·javascript·监控
大家的林语冰15 小时前
ESLint 近期动态大全,新版本正式发布,antfu 大佬推荐的插件也更新了!
前端·javascript·前端工程化
clint45615 小时前
C++进阶(1)——前景提要
c++