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 小时前
roLabelImg 详细安装教程
开发语言·人工智能·后端·云原生
Wang's Blog1 小时前
Go-Zero 项目开发47:自研微服务框架的必要性与核心结构设计
开发语言·微服务·golang
白鸽(二般)2 小时前
MinIO Java Client API
java·开发语言
hPw0eKIqD2 小时前
C++ 模板参数推导问题小记(非推导上下文)
开发语言·c++
程序员爱德华2 小时前
Python与C++:异同点对比
c++·python
临床数据科学和人工智能兴趣组2 小时前
要使用 R Markdown,首先需要安装 R 和 RStudio,接着安装 rmarkdown 包
开发语言·数据挖掘·数据分析·r语言·r语言-4.2.1
Nebula嵌入式3 小时前
【C语言】09-深入解析main函数
linux·c语言·开发语言·嵌入式
神罚天下ET5 小时前
c# ACME client (补充)
开发语言·c#
小灰灰搞电子5 小时前
Qt 实现魔法导航菜单源码分享
开发语言·qt
持敬chijing5 小时前
Python概述
开发语言·python