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
相关推荐
wuminyu3 小时前
Kafka中sendfile与mmap实现机制解析
java·linux·c语言·jvm·c++
言乐65 小时前
Python加速器4跨境网络加速器
运维·服务器·开发语言·网络·python
金金计较.5 小时前
Go语言-3
java·开发语言·golang
张小凡vip6 小时前
python--爬虫--经验积累的遇到的坑
开发语言·爬虫·python
Wang's Blog7 小时前
Java框架快速入门: Spring Security+OAuth2之云服务集成与多因子认证设计
java·开发语言·spring
门思科技7 小时前
LoRaWAN 网络容量估算:一个 SX1302 网关到底能带多少设备
开发语言·网络·php
大草原的小灰灰7 小时前
Python基础语法
开发语言·python
雪芽蓝域zzs8 小时前
vue解构平铺VS对象包裹
前端·javascript·vue.js
无小道8 小时前
C++——列表初始化
c++·列表初始化
blueSatchel8 小时前
c++action 编写(ros-humble)
c++·ros2