Getter and Setters
Learn how to read and write properties using getters and setters.
We'll cover the following
Introduction
Getters and setters are special methods that provide read and write access to an object’s properties. Recall how we were able to retrieve and set the values of instance variables using the dot operator (.
). Each instance variable has an implicit getter and setter which we have been using up until now. In this lesson, we will explore the getter and setter methods.
Create a free account to access the full course.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy