What is a information hiding in object oriented programming

Last updated:9/23/2020 4:39:37 PM

1 Answers

Barbara Jones
Barbara Jones

In our everyday life, many of us oftentimes try to hide information from other people. In many situations, the information hiding is an essential part of our life. For example, when we go grocery shopping, do we allow the store clerk to withdraw money from our wallet? The wallet (which is an object in object-oriented terms) hides money (which is the information or attribute/field of an object) from outsiders. A wallet may provide a method called “pull out X dollars” that, when executed by an outside object, results in handing over X dollars to the caller without disclosing how much money is in it. This is called information hiding in object-oriented programming.