Encapsulation (C#)
Në shqip: Enkapsulimi në C#
ShpjegimiSQ
Në C#, enkapsulimi bëhet me fusha private dhe veti publike që kontrollojnë aksesin — p.sh. { get; private set; } lejon leximin nga jashtë, por ndryshimin vetëm brenda klasës.
EnglishEN
In C#, encapsulation uses private fields and public properties that control access — e.g. { get; private set; } allows reading from outside but changing only inside the class.
Si ta mendosh
Si banka: e sheh bilancin, por paratë i lëviz vetëm përmes sportelit.
Lexoje në anglisht
Like a bank: you see the balance, but money moves only through the counter.
Shembull kodicsharp
public class Llogari {
public decimal Bilanci { get; private set; }
public void Depozito(decimal x) { if (x > 0) Bilanci += x; }
}