Encapsulation with 'Setter' and 'Getter' methods in Classes | Python
Dr Pi
#Classes #Encapsulation #Python #Setter #Getter
To avoid direct access of a class field i.e. private variables cannot be accessed directly or modified by external user, setter and getter methods are used.
Here I demonstrate a basic example of this.
Next time we'll look at @property decorators...(nothing to do with Dulux or dust sheets).
Check out the Minimalist online python IDE : https://epyco.herokuapp.com/ https://epico.herokuapp.com/
Buy Dr Pi a Coffee...or Tea! : https://www.buymeacoffee.com/DrPi ... https://www.youtube.com/watch?v=tfl-UXq8I_A
2020-10-12
0.0 LBC
Copyrighted (contact publisher)
53215318 Bytes