What is Data Hiding?

Total Post:135

 826  View(s)
Rate this:
I have basic doubts regarding Data(or Information) Hiding.  What is Data Hiding?
How to implement in C#? What is the difference/relation between Data Hiding and Encapsulation?(Both looks similar)
  1. Post:154

    Re: What is Data Hiding?

    Encapsulation is more about keeping a group of code as a discreet work unit but it also has data hiding because you only expose "the method" rather than its inner workings to other classes. Encapsulating leads to data hiding, so that's why it sounds similar. 
    Data hiding on its own it by only marking those things as a public scope which you want external classes to interact with, and private otherwise.  If you don't want other classes or only certain classes to use, you can also use private (current class only), protected (current and children), and internal (treated as public to other classes in the same assembly, private to outside assembly classes) to prevent other classes beyond a certain scope from using your methods/properties/classes.

      Modified On Apr-10-2018 11:57:46 PM