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
相关推荐
西幻凌云14 小时前
认识STL序列式容器——List
开发语言·c++·stl·list·序列式容器
~无忧花开~14 小时前
JavaScript实现PDF本地预览技巧
开发语言·前端·javascript
靠沿14 小时前
Java数据结构初阶——LinkedList
java·开发语言·数据结构
4***997414 小时前
Kotlin序列处理
android·开发语言·kotlin
froginwe1114 小时前
Scala 提取器(Extractor)
开发语言
t***D26414 小时前
Kotlin在服务端开发中的生态建设
android·开发语言·kotlin
Elias不吃糖15 小时前
LeetCode每日一练(209, 167)
数据结构·c++·算法·leetcode
Want59515 小时前
C/C++跳动的爱心②
c语言·开发语言·c++
初晴や15 小时前
指针函数:从入门到精通
开发语言·c++