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
相关推荐
渡我白衣1 小时前
并查集:基础认识与模拟实现
android·java·javascript·数据结构·c++·算法·并查集
天下无敌笨笨熊1 小时前
C#Modbus串口开发心得
开发语言·c#
电商API_180079052471 小时前
电商商品价格监控工具淘宝京东商品价格抓取API项目实操分享
java·大数据·开发语言·前端·数据挖掘
zzzll11111 小时前
深度剖析:HashMap 并发死循环与 ConcurrentHashMap 两代演进全解
java·开发语言
如意猴1 小时前
【C++】001--C++入门(1)
开发语言·c++
hetao17338372 小时前
2026-09-01~09-04 hetao1733837 的刷题记录
c++·算法
传奇开心果编程2 小时前
【Rust入门知识点学与练】第10课:Option 和 Result(错误处理入门)
开发语言·学习·rust
leonkay2 小时前
C# 锁机制——【2】深入原理
开发语言·后端·spring·c#·个人开发
坐吃山猪2 小时前
【多线程】CompletableFuture使用
java·开发语言·多线程
八角丶2 小时前
Node 网络编程 —— TLS 模块
javascript·后端·node.js