Encapsulation
This one of the basic concept of OOP. this is approach to make security to the class, such as private or public. so in this encapsulation it can hide the fields in the class..
Example code for the Encapsulation Concept
This one of the basic concept of OOP. this is approach to make security to the class, such as private or public. so in this encapsulation it can hide the fields in the class..
Example code for the Encapsulation Concept
class Demo
{
private int _mark;
public int Mark
{
get { return _mark; }
set { if (_mark > 0) _mark = value; else _mark = 0; }
}
}