国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Principle of information hiding in Java

2023-03-11 20:19 作者:ParisBarcelona  | 我要投稿

Here's?an analogy.

Imagine a vending machine. It has a public interface that you can use to buy snacks or drinks. You can insert coins, push buttons, and receive your purchase. However, the internal mechanism of the vending machine, such as the motor, the sensors, and the inventory, is hidden from you. You don't need to know how the vending machine works to use it.


Now, imagine that the vending machine manufacturer wants to improve the design of the vending machine. They want to change the motor, the sensors, and the inventory without affecting the public interface. They can do that, because the public interface remains the same. You can still insert coins, push buttons, and receive your purchase, even though the internal mechanism has changed.


This is similar to the principle of information hiding in Java. A class has a public interface that its clients can use, such as public methods or fields. However, the internal details of the class, such as private methods or fields, are hidden from the clients. This allows the class to change its internal details without affecting its clients, as long as the public interface remains the same.


Principle of information hiding in Java的評論 (共 條)

分享到微博請遵守國家法律
望都县| 十堰市| 开封县| 九寨沟县| 伽师县| 永吉县| 克拉玛依市| 保定市| 开远市| 陇川县| 锦屏县| 民丰县| 旬邑县| 六枝特区| 汶川县| 怀集县| 公安县| 江津市| 宁明县| 桃江县| 南陵县| 开封市| 方正县| 石门县| 临清市| 法库县| 茌平县| 石台县| 剑阁县| 三门县| 平江县| 汾西县| 通化市| 章丘市| 浦北县| 交城县| 延吉市| 郓城县| 阿勒泰市| 彰化县| 涿州市|