当前位置:网站首页>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
边栏推荐
- 在线Excel转CSV工具
- [leetcode refers to offer 42. Maximum sum of continuous subarrays (simple)]
- C list data paging
- Database Experiment 2 data query
- Online timing flow chart making tool
- leetcode 2223 — 构造字符串的总得分和
- Mixed use of Oracle column row conversion and comma truncated string
- IIS cannot load * woff,*. woff2,*. Solution of SVG file
- LabVIEW采集鼠标、键盘数据
- 延时消息常见实现方案
猜你喜欢

服务雪崩、服务熔断、服务降级

Mixed use of Oracle column row conversion and comma truncated string
![[※ leetcode refers to offer 48. The longest substring without repeated characters (medium)]](/img/fa/99b64267fd890c6c40847548f077b3.png)
[※ leetcode refers to offer 48. The longest substring without repeated characters (medium)]

Ribbon停止维护

consul server 服务注册中心安装

Introduction to hystrix and implementation of server fuse

consul client客户端开发
![[leetcode refers to offer 18. Delete the node of the linked list (simple)]](/img/ee/1a546e2383948ad9a4ce69b4508e90.png)
[leetcode refers to offer 18. Delete the node of the linked list (simple)]

Database Experiment four View experiment

Database Experiment 2 data query
随机推荐
Pycharm Chinese plug-in
Subcontracting of wechat applet based on uni app
consul 开启健康监控检查
Implementation of service fusing
Ribbon负载均衡策略
ERP function_ Financial management_ Basic concepts of Finance
Oracle intercepts special characters
Tear the Google SRE book by hand
Handling of alternative solutions for openfeign integration with hystrix
OpenFeign调用详细日志展示
hystrix dashboard的使用
Leaf Smecta
[leetcode refers to offer 18. Delete the node of the linked list (simple)]
JS merge duplicate data in array object
Resolve the "chromedriver executable needs to be in path" error
Display, move, rotate
LabVIEW采集鼠标、键盘数据
分布式系统服务熔断
On nanopi M1 (Quanzhi H3) kernel driver programming HelloWorld (compilation mode I)
Echerts add pie chart random color