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
相关推荐
玖釉-2 分钟前
Vulkan 离屏渲染详解:从 Framebuffer 到后处理、阴影贴图与 Render Texture
c++·windows·计算机视觉·图形渲染
wgc2k3 分钟前
Nest.js 基础-8-Hello,NestJS
开发语言·javascript·ecmascript
Larcher7 分钟前
从 0 到 1:用 Bun + axios 快速搭建 LLM API 客户端
前端·javascript
子午10 分钟前
基于DeepSeek的酒店客房管理系统~Python+DeepSeek智能问答+Vue3+Web网站系统
开发语言·前端·python
ghie909010 分钟前
基于 MATLAB 的序贯蒙特卡洛概率假设密度多目标跟踪实现
开发语言·matlab·目标跟踪
我命由我1234512 分钟前
Java 开发 - Jar 包与 War 包
java·开发语言·java-ee·intellij-idea·jar·idea·intellij idea
cpp_250112 分钟前
P2947 [USACO09MAR] Look Up S
数据结构·c++·算法·题解·单调栈·洛谷
峰上踏雪13 分钟前
Windows 下最推荐的 Qt + VS2026 + CMake 开发方案
开发语言·windows·qt
楼田莉子19 分钟前
C++20新特性:协程
开发语言·c++·后端·学习·c++20
xiaoshuaishuai821 分钟前
C# AvaloniaUI 中旋转
开发语言·c#