当前位置:网站首页>Member and non member functions
Member and non member functions
2022-04-23 22:05:00 【Scarcity risk humility】
Member functions : Functions defined in a class ;
Nonmember functions : Functions that are not defined in a class ;
So whether to choose the member function of the class or the non member function of the class ?
Object oriented requires , Put the functions that manipulate the data together with the data . But that doesn't mean choosing member functions . From the perspective of packaging , Of a member function moringAction Encapsulation is lower than non member functions . If something is encapsulated , It is no longer visible . The more things are encapsulated , The less people can see it . So classes that use non member functions , Low encapsulation . And the less people see it , The more flexibility we have to change it , Because our changes only directly affect those who see the changes . therefore , The more things are encapsulated , The greater the ability to change something .
Data within the object under consideration . The less code you can see the data ( Visit it ), More data can be encapsulated , And the more free we are to change the object data . Now if a member function 、 Non member functions can provide the same function , We choose non member functions .
版权声明
本文为[Scarcity risk humility]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/113/202204232201249834.html
边栏推荐
- C# ftpHelper
- 关于DateUtil时间工具类造成程序报错
- DW basic tutorial (I)
- LabVIEW采集鼠标、键盘数据
- Tear the Google SRE book by hand
- Error message: b04access.00f eve'. Read of address 000001B4
- Correction of date conversion format error after Oracle adds a row total
- Common implementation schemes of delay message
- VMware download and installation links are very easy to use
- Ensuring the quality of living materials and food safety in Shanghai
猜你喜欢
开发consul 客户端即微服务
清华大学 | WebFace260M:百万级深度人脸识别的基准(TPAMI2022)
修改服务的默认负载均衡策略
2. GPIO control summary (kernel driver) of nanopi M1 (Quanzhi H3)
Openharmony get the source code
JS prototype and prototype chain
服务熔断的实现
Database experiment VI integrity language experiment
Oracle ora-01033: Oracle initialization or shutdown in progressprocess solution
[leetcode sword finger offer 10 - II. Frog jumping steps (simple)]
随机推荐
服务间通信方式
Keras. Layers introduction to various layers
[leetcode sword finger offer 58 - I. flip word order (simple)]
Introduction to hystrix and implementation of server fuse
从严从重从快 上海全面加强疫情期间食品安全监管
[※ leetcode refers to offer 46. Translate numbers into strings (medium)]
Resolve the "chromedriver executable needs to be in path" error
Pycharm download and installation
Introduction to tensorrt
降级和熔断总结
consul server 服务注册中心安装
服务降级的实现
IIS cannot load * woff,*. woff2,*. Solution of SVG file
Pycharm Chinese plug-in
[leetcode refers to offer 52. The first common node of two linked lists (simple)]
April 24, 2022 Daily: current progress and open challenges of applying deep learning in the field of Bioscience
Lightweight project management ideas
[leetcode refers to offer 21. Adjust the array order so that odd numbers precede even numbers (simple)]
[leetcode refers to offer 22. The penultimate node in the linked list (simple)]
Ribbon停止维护