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
What are .net applications?
What is Polymorphism? How does VB.NET/C# achieve polymorphism?
Should I use readerwriterlock instead of monitor.enter/exit?
Explain what are an object and a class?
Explain why do we use the “using” statement?
Explain what is the difference between a class and an object, and how do these terms relate to each other?
Describe session handling in a webform, how does it work and what are the limitations?
What is an exe and a dll?
What is the use com component in .net?
Explain how to spawn a thread?
Explain what inheritance is, and why it's important?
How to get the number after decimal point in .net?
Write the .net syntax for 'while loop'?
Please explain the difference between constants and read-only variables?
Explain what is the difference between odbc and ado?