当前位置:网站首页>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
边栏推荐
- 软件测试对于减少程序BUG有多大帮助?
- 《通用数据保护条例》(GDPR)系列解读三:欧洲子公司如何向国内母公司回传数据?
- SQL 练习(一)
- Yunna | how to manage the company's fixed assets and how to manage fixed assets
- Running error: unable to find or load the main class com xxx. Application
- Step function of activation function
- PSCP basic usage
- Sofa weekly | excellent Committee of the year, contributor of this week, QA of this week
- 1.Electron开发环境搭建
- 第四章 为IM 启用填充对象之为IM列存储启用ADO(IM 4.8)
猜你喜欢

Tensorflow uses keras to create neural networks

Nacos Foundation (8): login management

Win10 splash screen after startup

Idea setting copyright information

5个免费音频素材网站,建议收藏

《通用数据保护条例》(GDPR)系列解读三:欧洲子公司如何向国内母公司回传数据?

IDEA 中 .properties文件的中文显示乱码问题的解决办法

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

软银愿景基金进军Web3安全行业 领投CertiK 6000万美元新一轮投资

The maximum number of remote desktop servers has been exceeded
随机推荐
第四章 为IM 启用填充对象之启用和禁用列(IM-4.3 第三部分)
oh-my-lotto
Array---
IDEA 代码质量规范插件SonarLint
Summary of convolution layer and pooling layer
第二十五课 类的静态成员变量
第四章 为IM 启用填充对象之为IM列存储启用ADO(IM 4.8)
如果你是一个Golang面试官,你会问哪些问题?
How to expand the capacity of the server in the 100 million level traffic architecture? Well written!
Sofa weekly | excellent Committee of the year, contributor of this week, QA of this week
论文解读(CGC)《CGC: Contrastive Graph Clustering for Community Detection and Tracking》
After a circle, I sorted out this set of interview questions..
The fourth chapter is to enable the filling object of IM and enable ADO for im column storage (IM 4.8)
第二十三课 临时对象
IDEA 代码格式化插件Save Actions
Fastjson 2 来了,性能继续提升,还能再战十年
1.Electron开发环境搭建
Idea code quality specification plug-in sonarlint
The fourth chapter is about enabling and disabling the im column storage of table space for im enabled filling objects (IM 4.5)
Nacos Foundation (6): Nacos configuration management model