- Encapsulation is process of hiding complex processing outside the word means you can create cover over data which protect the data from accessing outside word.
- Encapsulation can be achieved by using keyword like Public, private, Protected…..
Example:
public class Department
{
private string departname;
// Accessor.
public string GetDepartname()
{
return departname;
}
// Mutator.
public void SetDepartname( string a)
{
departname=a;
}
}
public static int Main(string[] args)
{
Department d = new Department();
d.SetDepartname("ELECTRONICS");
Console.WriteLine("The Department is :"+d.GetDepartname());
return 0;
}
See Also :
- How to show hidden theme in win 7.
- How To Make "Star Design" In CMD Windows.
- How to get color name in C#.Net
- How to change Logon Message in Windows7
- How to find the product Key of Windows XP CD
--
/\/ir@\/ <(.'.)>
0 comments:
Post a Comment
Thanks for comment