当前位置:网站首页>Lesson 26 static member functions of classes
Lesson 26 static member functions of classes
2022-04-23 12:07:00 【Night rain】
Lesson 26 Static member function of class
List of articles
One 、 Static member functions
characteristic
- You can access static member variables without relying on objects
- The security of static member variables must be guaranteed
- Get the value of static member variable conveniently and quickly
- Static member functions are special member functions in a class
- Static member functions belong to the entire class
- You can directly access public static member functions through the class name
- Public static function members can be accessed through objects
Definition
static type function()
Directly through static Keywords decorate member functions
Two 、 Static member functions and ordinary member functions
| Static member functions | Ordinary member functions | |
|---|---|---|
| All objects share | √ | √ |
| Implication this The pointer | × | √ |
| Access ordinary member variables ( function ) | × | √ |
| Access static member variables ( function ) | √ | √ |
| Call... Directly by class name | √ | × |
| Call directly through the object name | √ | √ |
3、 ... and 、 Summary
- Static member functions are special member functions in a class
- Static member functions have no hidden this The pointer
- Static member functions can be accessed directly through the class name
- Static member functions can only access static member variables directly ( function )
版权声明
本文为[Night rain]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231155355962.html
边栏推荐
- Interpretation 3 of gdpr series: how do European subsidiaries return data to domestic parent companies?
- Application of remote integrated monitoring system in power distribution room in 10kV prefabricated cabin project
- 第四章 为IM 启用填充对象之启用和禁用表空间的IM列存储(IM 4.5)
- 1. Construction of electron development environment
- Database Navigator 使用默认MySQL连接提示:The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or repres
- [redis series] redis learning 13. Redis often asks simple interview questions
- 第二十五课 类的静态成员变量
- 在 VSCode 中调试 Jest 的测试用例,VSCode调试Jest测试用例报错basedir=$(dirname “$(echo “$0“ | sed -e ‘s,\\,/,g‘)“)解决
- Nacos Foundation (8): login management
- AI 视频云 VS 窄带高清,谁是视频时代的宠儿
猜你喜欢

九十八、freemarker框架报错 s.e.ErrorMvcAutoConfiguration$StaticView : Cannot render error page for request

NativeForMySQL 连接MySQL8 提示:1251- Client does not support authentication protocol

论文解读(CGC)《CGC: Contrastive Graph Clustering for Community Detection and Tracking》

Running error: unable to find or load the main class com xxx. Application

How do programmers finalize nucleic acid statistics with 130 lines of code

c# 设置logo图标和快捷方式的图标

激活函数之阶跃函数

IDEA 代码格式化插件Save Actions

Nacos Foundation (9): Nacos configuration management from single architecture to microservices

Database design of simple voting system
随机推荐
Relu function of activation function
PSCP 基本使用
力扣-70.爬楼梯
The fourth chapter is about enabling and disabling the im column storage of table space for im enabled filling objects (IM 4.5)
Database design of simple voting system
Running error: unable to find or load the main class com xxx. Application
第五章 使用In-Memory表达式优化查询(IM 5.1)
Metalama简介4.使用Fabric操作项目或命名空间
Tips for installing MySQL service in windows11: Install / Remove of the Service denied
Fastjson 2 is coming, the performance continues to improve, and it can fight for another ten years
Idea code quality specification plug-in sonarlint
Castle.DynamicProxy实现事务单元控制
Chapter 5 optimizing queries using in memory expressions (IM 5.1)
Nativeformysql connects to MySQL 8 prompt: 1251 - client does not support authentication protocol
Win10 splash screen after startup
Share two practical shell scripts
Idea code formatting plug-in save actions
Windows11 安装MySQL服务 提示:Install/Remove of the Service Denied
远程访问家里的树莓派(上)
thinkphp 添加图片文字水印生成带二维码的推广海报