无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
太仆寺旗| 阿合奇县| 益阳市| 开化县| 揭阳市| 潍坊市| 岱山县| 武山县| 通渭县| 中阳县| 海兴县| 靖州| 渝北区| 博爱县| 永丰县| 辽阳市| 山阴县| 定边县| 阿拉善右旗| 都江堰市| 公安县| 浦城县| 满城县| 拉孜县| 济南市| 上林县| 苗栗县| 泸西县| 株洲县| 四平市| 屏东县| 峨眉山市| 兴业县| 沙河市| 祥云县| 缙云县| 吉首市| 崇明县| 寻乌县| 海阳市| 清水河县|