+ 1

Why do we need Setters and getters when we can use "=" and "return"?

Function of set & get

20th Nov 2019, 6:23 AM
Little Light 🕯️
Little Light 🕯️ - avatar
3 Réponses
+ 5
to protect private data from being accessed / modified directly. https://code.sololearn.com/WuswYAzn9MWs/?ref=app
20th Nov 2019, 6:26 AM
Gordon
Gordon - avatar
0
Thank you very much Gordon
20th Nov 2019, 6:28 AM
Little Light 🕯️
Little Light 🕯️ - avatar
0
Una de las bases principales de la POO es la encapsulación, los setters y getters cumplen parte de esa función. Investiga más sobre la POO y sus beses. Saludos.
20th Nov 2019, 4:21 PM
Jesús Petrona Castro
Jesús Petrona Castro - avatar