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
相关推荐
To_OC14 分钟前
LC 131 分割回文串:刚学回溯时,我连怎么切字符串都想不明白
javascript·算法·leetcode
炸膛坦客1 小时前
单片机/C/C++八股:(二十六)IIC 专题(I²C)---- 上集
c语言·c++·单片机
旖-旎1 小时前
LeetCode 518:零钱兑换||(完全背包)—— 题解
c++·算法·leetcode·动态规划·背包问题
灯澜忆梦1 小时前
GO_并发编程---定时器
开发语言·后端·golang
-银雾鸢尾-2 小时前
C#中的StringBuilder相关方法
开发语言·c#
To_OC2 小时前
LC 42 接雨水:暴力超时卡半天?前后缀数组一用就通了
javascript·算法·leetcode
Henry Zhu1232 小时前
C++中的特殊成员函数与智能指针
c++
小林ixn2 小时前
从 ??= 到 onKeyDown:一个 React 组件的“自我修养”
前端·javascript·react.js
-银雾鸢尾-2 小时前
C#中结构体与类的区别;抽象类与接口的区别
开发语言·c#
এ慕ོ冬℘゜3 小时前
前端实战:jQuery 多条件联合搜索(标题模糊查询 + 日历时间段筛选)
前端·javascript·jquery