what is incapsulation and how we can achieve incapsulation
Explain with example
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.
Upendra Pratap ShahiPosted Jun 14, 2015, 1:57 AM
Pankaj Kumar ChoudharyPosted Jun 13, 2015, 8:35 PM
Encapsulation is implemented by using access specifiers. An access specifier defines the scope and visibility of a class member. C# supports the following access specifiers:
Manoj BhoirPosted Jun 13, 2015, 1:10 PM
- Through encapsulation a class can hide the internal details of how an object does something. Encapsulation solves the problem at the implementation level.
- A class or structure can specify how accessible each of its members (variables, properties, and methods) is to code outside of the class or structure. Encapsulation simplifies the interaction between objects. An object can use another object without knowing all its data or how its data is maintained. For example, a Client object might have name, address, company, and department properties. If a Bank object wants to use a Client object, it can request the name and address for the bank without needing to know the company and department details of the Client object.
- With the help of encapsulation, a class can change the internal implementation without hurting the overall functionality of the system.
- Encapsulation protects abstraction.
Need or purpose of encapsulationFor more details and example check these links :