+ 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 Answers
+ 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