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
相关推荐
IT痴者1 小时前
《PerfettoSQL 的通用查询模板》---Android-trace
android·开发语言·python
2501_941111241 小时前
C++与自动驾驶系统
开发语言·c++·算法
2501_941111692 小时前
C++中的枚举类高级用法
开发语言·c++·算法
chilavert3182 小时前
技术演进中的开发沉思-191 JavaScript: 发展历程(上篇)
开发语言·javascript·ecmascript
旭编2 小时前
小红的好矩形
c++·算法
l1t2 小时前
调用python函数的不同方法效率对比测试
开发语言·数据库·python·sql·duckdb
dy17172 小时前
el-table表头上下显示内容
javascript·vue.js·elementui
今天吃饺子3 小时前
如何用MATLAB调用python实现深度学习?
开发语言·人工智能·python·深度学习·matlab
2501_941111463 小时前
C++与硬件交互编程
开发语言·c++·算法