Hi Stephen and thanks for your question which is interesting!
The set trap will be triggered when you set a property for the object that is being proxied.
motorcycle.brand="Triumph";
But when using the setter method motorcycle.setBrand("Triumph"); you are really just triggering the get trap, whether it is a property or in this case a method. Using a set trap wouldn't have helped us much.
Hope this answers your question.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Stephen and thanks for your question which is interesting!
The
set
trap will be triggered when you set a property for the object that is being proxied.But when using the setter method
motorcycle.setBrand("Triumph");
you are really just triggering theget
trap, whether it is a property or in this case a method. Using aset
trap wouldn't have helped us much.Hope this answers your question.