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 .net technology?

576


What is garbage collection and how it works. Provide a code example of how you can enforce garbage collection in .net?

516


What is func in .net 3.5?

565


What is difference between .net core and .net standard?

493


What is the difference between server.transfer and response.redirect? Why?

592






What are multicast delegates?

581


What is concurrency? How will you avoid concurrency when dealing with dataset?

593


Give a brief introduction on side-by-side execution. Can two applications, one using private assembly and the other using the shared assembly be stated as side-by-side executables?

520


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

564


Explain what is a delegate?

588


What is the need of OLE-automation?

639


What are the types of jit?

567


Explain what is the difference between web application and enterprise application?

550


Please tell us what is the difference between override and overload in a method?

573


Explain what is an interface and what is an abstract class? Please, expand by examples of using both. Explain why?

538