当前位置:网站首页>static关键字及应用
static关键字及应用
2022-04-23 22:01:00 【稀缺-风险-谦逊】
1、本程序页内使用,不同页面的同名变量不会冲突;
2、变量生命周期伴随整个程序生命周期;
1、静态数据成员也叫作类变量,普通数据成员也叫作实例变量;静态数据成员是每个class都有一份,普通数据成员是每个instance有一份;
2、静态成员函数:用于修饰class的成员函数
1.静态成员之间可以相互访问,包括静态成员函数访问静态数据成员和访问静态成员函数。
2.非静态成员函数可以任意的访问静态成员函数和静态数据成员。
3.静态成员函数不能访问非静态成员函数和非静态数据成员。
4.调用静态成员函数,可以用成员访问操作符(.)和(->)为一个类的对象或指向类对象的指针调用静态成员函数,也可以使用类名::函数名调用(因为他本身属于类,用类名调用很正常)
版权声明
本文为[稀缺-风险-谦逊]所创,转载请带上原文链接,感谢
https://blog.csdn.net/zhou_z_p/article/details/124364210
边栏推荐
- Devops and cloud computing
- OpenFeign组件的简介和使用
- [leetcode refers to offer 22. The penultimate node in the linked list (simple)]
- consul 开启健康监控检查
- 延时消息常见实现方案
- C language programming based on loop structure (PTA)
- Database Experiment 3 data update experiment
- [leetcode refers to offer 18. Delete the node of the linked list (simple)]
- hystrix dashboard的使用
- OpenFeign的参数传递之数组和集合类型
猜你喜欢

Cancel the default open project setting of idea

Database Experiment 3 data update experiment

Database experiment VI integrity language experiment

轻量化项目管理思路

What if Jenkins forgot his password

Pycharm Chinese plug-in

How Axure installs a catalog

Plato Farm元宇宙IEO上线四大,链上交易颇高

OpenFeign超时设置

Resolve the "chromedriver executable needs to be in path" error
随机推荐
Implementation of service fusing
Detailed explanation of basic assembly instructions of x86 architecture
Resolve the "chromedriver executable needs to be in path" error
[leetcode refers to offer 52. The first common node of two linked lists (simple)]
How to use the project that created SVN for the first time
Database Experiment 3 data update experiment
[leetcode refers to offer 10 - I. Fibonacci sequence (simple)]
Strictly, severely and quickly strengthen food safety supervision during the epidemic in Shanghai
基于Ribbon的服务调用
Centos7 builds MySQL master-slave replication from scratch (avoid stepping on the pit)
清华大学 | WebFace260M:百万级深度人脸识别的基准(TPAMI2022)
Database experiment I database definition and data import
[leetcode refers to the maximum profit of offer 63. Stock (medium)]
Echerts add pie chart random color
Presto on spark supports 3.1.3 records
Sqlserver edits data in the query interface (similar to Oracle's edit and ROWID)
Online timing flow chart making tool
在线时序流程图制作工具
ROS learning notes - tutorial on the use of ROS
服务雪崩效应