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 the best way to crack the certification?

1595


How to manage pagination in a page using .net?

780


What is meant by globalization?

779


What class does icon derive from? Isn't it just a bitmap with a wrapper name around it?

823


What is .net and .net framework?

838


object is physical and class is logical..here class is not occupying any memory as our definition of class but i got a question then the class where it stores if it is not occupying any memory....

1867


What is meant by managed and unmanaged code?

879


What is a serviced component?

759


What is "common language specification" (cls) in .net?

759


What is finalize method in .net?

862


What is singleton activation mode in .net?

914


Is there a way to suppress the finalize process inside the garbage collector forcibly in .net?

716


What is RCW (Run time Callable Wrappers)?

2164


Explain what is the difference between a class and an object?

871


What is data type and how many types of data types are in .NET ?

762