What are the get
and set
keywords for if we can just replicate the same functionality with normal methods and use parentheses to invoke them?
Is it just to make it clear to other programmers that this method retrieves the property, while this other one sets it?
Also from the previous lesson:
properties cannot share the same name as the getter/setter function. If we do so, then calling the method will result in an infinite call stack errorHow would that work?