Data Hiding In OOP

hoe data hiding is possible in object oriented approch?give me an example please..........

Replies

  • rahul69
    rahul69
    nidhs
    hoe data hiding is possible in object oriented approch?give me an example please..........
    For example: private data members of a class are hidden from outside.
  • nidhs
    nidhs
    but we can call this data members by their functions.......so how it will be hidden?
  • rahul69
    rahul69
    nidhs
    but we can call this data members by their functions.......so how it will be hidden?
    Yes we can use functions to access, but then, what is the fun of hiding if u cannot get it when u need it. Think hiding for a simple function(eg add), when a function is called, it's call does not tell actual implementation of that function (ie. how it calculate the value to be returned), similarly when a user clicks add button, he does not know what happens behind scenes. He just know what he needs to know and the rest is hidden.
    Hope it clears it a bit.
  • nidhs
    nidhs
    ya...thanks
    but it is also implement in procedural oriented....
    if we create add fun and we also can't see actual implementation.....so what is the different
  • rahul69
    rahul69
    but it is also implement in procedural oriented....
    Yup u r right, but that was just an analogy to explain the concept, in OOP data is hidden inside private data members so that even objects cannot directly access it,and require function calls for the same.

You are reading an archived discussion.

Related Posts

how to integrate with facebook? and what is the use of it . i tried on myself but it shows some unknown error.plz reply.
from the following which types of corrosion in fresh water of D/E a. Stress b. Hot corrosion c. bimetallic d. selective phase corrosion...
centrifugal pumps cannot handle air and require priming.but you are aware that centrifugal blower which on the same principal can handle air very well. which two properties of air are...
what is the difference between inheritance and generalization??? if both are same then why we use different names?
The type of the system whose transfer function is given by G(S) =(s2+3)/(s5+s4+s3+3s2+2s) is: