I have a question a bout Getter and Setter, need help!

I have some questions about Getter and Setter as follows:

1. Is it only available in Object?

2. What is its use?

Thank you!!!

I found a pretty good article that answers your questions.

Yes, these methods are only currently available in objects.

The purpose of getters and setters are as their names suggest, get and set values in objects. These are named like this so that their purposes are very straightforward and only accomplish getting and setting.

1 Like

thank you very much!!