Can u explain me What is encapsulation?

Answer Posted / manikanta.srinu

Wraping(Binding) of data in a single unit.
Encapsulation is combines one or more information into a
component.
* You hide the data for security such as making the
variables as private, and expose the property to access the
private data which would be public.
So, when you access the property you can validate the
data and set it.
Eg 1: Capsule is mixed with one or more medicine and packed
into the tube. so its related and acting in two moducles.
EX:public class Demo
{
private int _mark;

public int Mark
{
get { return _mark; }
set { if (_mark > 0) _mark = value; else _mark = 0; }
}
}

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is connected and diconnected database ?

841


What's the problem with .net generics?

786


How inheritance works in .net?

806


Please explain what is the .net framework and how does it work?

749


If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?

1842


What is common language specification (cls)?

845


Difference between dispose and finallize method?

943


How to customize the trace output?

781


How to implement datagrid in.net? How would you make a combo-box appear in one column of a datagrid? What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for datagrid methods. What is the access specifier used for that methods in the code behind file and why?

798


What is the difference between imperative and interrogative code?

1835


What is the difference between user control an custom control? Advantages/disadvantages?

799


What is a serviced component?

778


explain the states of a window service application?

773


Is .net capable of supporting multi-thread?

784


Is Driver Script any how related to AOM?

895