Properties and Encapsulation
Before we start to explain properties, you should have a basic understanding of “Encapsulation“.
The meaning of Encapsulation, is to make sure that “sensitive” data is hidden from users. To achieve this, you must:
- declare fields/variables as
private
- provide
public
get
andset
methods, through properties, to access and update the value of aprivate
field