当前位置:网站首页>Lesson 25 static member variables of classes
Lesson 25 static member variables of classes
2022-04-23 12:07:00 【Night rain】
Lesson 25 Static member variable of class
List of articles
One 、 review
- Access to... By name public Member variables
- The variables of each object are exclusive
- Member variables cannot be shared between objects
Two 、 Static member variable
- stay C++ Static member variables can be defined in
- Static member variables belong to the entire class
- The life cycle of a static member variable does not depend on any object
- Common static member variables can be accessed directly through the class name
- All objects share static member variables of the class
- Common static member variables can be accessed through object names
characteristic
- Directly through when defining static Keyword modification
- Static member variables need to allocate space outside the class
- Static member variables are located in the global data area inside the program
Rule of grammar
type classname::varName = value;
Example
class test{
private:
static int t1;// Static member functions
};
int test::t1 = 0;// You also need to define
3、 ... and 、 Summary
- Class can be passed through static Keyword to define static member variables
- Static member variables belong to all classes
- Every object can access static member variables
- Static member variables allocate space in the global data area
- The lifetime of static member variables is the running time of the program
版权声明
本文为[Night rain]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231155356003.html
边栏推荐
- Precautions for PCB
- 第四章 为物化视图启用和禁用IM列存储(IM 4.6)
- VMware virtual machines export hard disk vmdk files using esxi
- The fourth chapter is about enabling and disabling the im column storage of table space for im enabled filling objects (IM 4.5)
- 第五章 使用In-Memory表达式优化查询(IM 5.1)
- The fourth chapter is to enable the filling object of IM and enable ADO for im column storage (IM 4.8)
- 5个免费音频素材网站,建议收藏
- How to switch PHP version in Windows 2008 system
- 在 VSCode 中调试 Jest 的测试用例,VSCode调试Jest测试用例报错basedir=$(dirname “$(echo “$0“ | sed -e ‘s,\\,/,g‘)“)解决
- Tensorflow common functions
猜你喜欢
抓包整理————tcp 协议[八]
Windows11 安装MySQL服务 提示:Install/Remove of the Service Denied
《通用数据保护条例》(GDPR)系列解读三:欧洲子公司如何向国内母公司回传数据?
worder字体网页字体对照表
Use kettle to copy records to and get records from results
Why is there a wrapper class? By the way, how to convert basic data types, wrapper classes and string classes?
VMware virtual machines export hard disk vmdk files using esxi
Xinwangda announced that the price of battery products had been increased, and the investment of "weixiaoli" exceeded 1 billion
Application of remote integrated monitoring system in power distribution room in 10kV prefabricated cabin project
How do programmers finalize nucleic acid statistics with 130 lines of code
随机推荐
运行报错:找不到或无法加载主类 com.xxx.Application
IM表达式的目的(IM 5.2)
Solution of asynchronous clock metastability -- multi bit signal
Recommended programming AIDS: picture tool snipaste
对称加密、证书加密
Database design of forum system
欣旺达宣布电池产品涨价 此前获“蔚小理”投资超10亿
Sofa weekly | excellent Committee of the year, contributor of this week, QA of this week
5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型
面了一圈,整理了这套面试题。。
Purpose of IM expression (IM 5.2)
IMEU如何与IMCU相关联(IM 5.5)
ImportError: libX11. so. 6: cannot open shared object file: No such file or directory
IDEA 中 .properties文件的中文显示乱码问题的解决办法
IFLYTEK's revenue in 2021 was 18.3 billion yuan: a year-on-year increase of 41% and a net profit of 1.556 billion yuan
SOFA Weekly | 年度优秀 Committer 、本周 Contributor、本周 QA
画结果图推荐网址
IDEA 代码质量规范插件SonarLint
Idea database navigator plug-in
Nativeformysql connects to MySQL 8 prompt: 1251 - client does not support authentication protocol