#Setter & Getter

17 messages · Page 1 of 1 (latest)

empty zodiac
#

I don't understand..

devout groveBOT
#

When your question is answered use !solved or the button below to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

hidden shell
#

what don't you understand

#

why they exist?

#

they are great for flexibility, if down the road you want to add some extra functionality when a value changes you can add that in the setter rather than modify every line of code that sets it

#

also with binary compatibility, if you have a library that doesn't use setters and your class' data layout changes, any program that links to a previous version of your library will stop working

empty zodiac
#

Ohhhhh like its a muchine that make stuff?

#

Like a code that basicly controls and can change the large amount of codes with setters and getters

neat ore
#

No its just functions that set (setter) or retreive (getter) the value of an object

#

More specifically they are member functions that set and get values of private class member objects.

empty zodiac
#

So setter and getters does the job of like simplfying the codes(Organize codes) and can be used in modyfing code faster?

#

Based om ms. Camila and Epsilon info, setters & getters has the input(setting value) and output(getting value) of an object and used in public or private. Also the code can be changed depending on setters and getters.

empty zodiac
#

Guess My problem has been solved👍

devout groveBOT
# devout grove

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

alpine mist
# empty zodiac I don't understand..

yeah in short if you have private members getters allows you to get the private member indirectly. setters allows you to set the value of the private member indirectly as well. thats how it works in short