当前位置:网站首页>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
边栏推荐
- Pipes and xargs
- Flomo software recommendation
- [leetcode refers to offer 47. Maximum value of gift (medium)]
- RestTemplate 服务调用
- MySQL 回表
- 基于RestTemplate的服务调用
- Online Excel to CSV tool
- 一文解决浏览器跨域问题
- Sqlserver edits data in the query interface (similar to Oracle's edit and ROWID)
- April 24, 2022 Daily: current progress and open challenges of applying deep learning in the field of Bioscience
猜你喜欢
RestTemplate 服务调用
JUnit unit test ---- a good tool for testing a single method
OpenFeign调用详细日志展示
Introduction to tensorrt
Tsinghua University | webface260m: benchmark for million level deep face recognition (tpami2022)
[※ leetcode refers to offer 48. The longest substring without repeated characters (medium)]
修改服务的默认负载均衡策略
Tear the Google SRE book by hand
[leetcode refers to offer 32 - III. print binary tree III from top to bottom (medium)]
服务注册中心和Ribbon组件回顾
随机推荐
OpenFeign的细节展示
Sklearn function: Train_ Test_ Split (split training set and test set)
Online timing flow chart making tool
Daily operation and maintenance knowledge -- 1
分布式系统服务熔断
ERP function_ Financial management_ The difference between red and blue words in invoices
Lightweight project management ideas
Oracle updates the data of different table structures and fields to another table, and then inserts it into the new table
Database Experiment 2 data query
Introduction to tensorrt
2022-04-24日報:在生物科學領域應用深度學習的當前進展和開放挑戰
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:app:stripDe
JS to get the browser and screen height
延时消息常见实现方案
Error message: b04access.00f eve'. Read of address 000001B4
Hystrix断路器开启条件和流程以及默认备选处理
A series of problems of C DataGridView binding list
Ensuring the quality of living materials and food safety in Shanghai
开发consul 客户端即微服务
IIS cannot load * woff,*. woff2,*. Solution of SVG file