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
相关推荐
NiNi_suanfa19 小时前
【Qt】Qt 批量修改同类对象
开发语言·c++·qt
小糖学代码19 小时前
LLM系列:1.python入门:3.布尔型对象
linux·开发语言·python
Data_agent20 小时前
1688获得1688店铺详情API,python请求示例
开发语言·爬虫·python
大怪v20 小时前
【Virtual World 03】上帝之手
前端·javascript
信奥胡老师20 小时前
苹果电脑(mac系统)安装vscode与配置c++环境,并可以使用万能头文件全流程
c++·ide·vscode·macos·编辑器
妖灵翎幺20 小时前
C++ 中的 :: 操作符详解(一切情况)
开发语言·c++·ide
Halo_tjn20 小时前
虚拟机相关实验概述
java·开发语言·windows·计算机
star _chen21 小时前
C++实现完美洗牌算法
开发语言·c++·算法
周杰伦fans21 小时前
pycharm之gitignore设置
开发语言·python·pycharm
繁星星繁21 小时前
【C++】脚手架学习笔记 gflags与 gtest
c++·笔记·学习