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
相关推荐
码途行者2 小时前
每天10分钟学Go:第17课 接口interface-只规定“能做什么“,不管它是什么
开发语言·后端·golang
头发还在的女程序员2 小时前
Java充电桩平台源码解析:枪口状态、上报时间与页面刷新怎样协同
java·开发语言·充电桩系统·充电桩管理·充电系统·充电小程序
timeDifference₇4 小时前
Python Vibe Coding实操实验报告
开发语言·jvm·python
geovindu5 小时前
python:DecisionTree
开发语言·后端·python·算法
ShineWinsu5 小时前
对于Qt:事件的解析
c++·qt·面试·笔试·gui·客户端·事件
geovindu6 小时前
python: Decision Tree Regressor
开发语言·后端·python·算法·决策树
bai2737 小时前
path.join('C:\a', '\b') 给我 C:\a\b,path.resolve 给 C:\b:Windows 上 51 行路径实测
javascript·后端
闻缺陷则喜何志丹7 小时前
【数论】P10136 [USACO24JAN] Cowlendar S|普及+
c++·数学·数论·洛谷
kyriewen7 小时前
我写的 12 个 AI Skill,三个月后 8 个在吃空饷
javascript·人工智能·程序员
apcipot_rain8 小时前
某游戏公司C++游开实习 机试复盘
c++·游戏