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
相关推荐
2301_789015622 小时前
DS进阶:AVL树
开发语言·数据结构·c++·算法
Filotimo_3 小时前
5.3 Internet基础知识
开发语言·php
识君啊3 小时前
Java异常处理:中小厂面试通关指南
java·开发语言·面试·异常处理·exception·中小厂
qyzm5 小时前
天梯赛练习(3月13日)
开发语言·数据结构·python·算法·贪心算法
leluckys5 小时前
swift- Swift中常见的面试题
开发语言·汇编·swift
BUG_MeDe5 小时前
json格式字符串解析的简单使用 libjson-c
c语言·开发语言·json
唐叔在学习6 小时前
e.preventDefault()到底怎么用?
前端·javascript
CoderCodingNo6 小时前
【GESP】C++五级练习题 luogu-P1182 数列分段 Section II
开发语言·c++·算法
Highcharts.js6 小时前
Highcharts React v4.2.1 正式发布:更自然的React开发体验,更清晰的数据处理
linux·运维·javascript·ubuntu·react.js·数据可视化·highcharts