Encapsulation
noun
say it: “en-kap-syuh-LAY-shun” /ɪnˌkæpsjəˈleɪʃən/
Keeping an object's data private and letting other code read or change it only through its methods and properties.
What is Encapsulation in C#?
Encapsulation — Keeping an object's data behind methods that control how it is read or changed.
class Thermostat
{
public int Temperature
{
get;
set;
}
}
In a sentence
- “Thanks to encapsulation, nobody can set a team's wins to -3; the property refuses it.”
Level: Journeyman · More C# terms at this level
Updated