Hi,
Apart from using modifiers how can we implement encapsulation?
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kavita BPosted Mar 29, 2011, 9:45 PM
Thanks a lot,i`m just a beginner need to know many things,sometimes my questions may not be clear so please don`t mind...
VulpesPosted Mar 29, 2011, 7:46 AM
Kavita BPosted Mar 29, 2011, 7:35 AM
Thanks for replying..Can encapsulation be implemented in any other way apart from what as been discussed till now???
VulpesPosted Mar 29, 2011, 4:58 AM
However, as I intimated in your thread about private classes, when members of an interface are implemented explicitly this does achieve a level of encapsulation (in the 'hiding functionality' sense). This is because the method isn't marked ''public' and the caller therefore needs to be aware that you need an interface reference (not a reference to an object of the class itself) to call the method.
In contrast properties normally achieve encapsulation by hiding data (i.e. their backing fields).
Kavita BPosted Mar 28, 2011, 9:49 PM
Are interfaces also used for the same?
Mahesh ChandPosted Mar 28, 2011, 9:33 PM