You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It depends - if mutator methods enforce some invariants on an attribute I'd definitely use them. Same goes for reader methods that return a defensive copy of an attribute. Otherwise - attribute access is a little bit faster than method calls (although they might be inlined).
Wondering which the preferred method...
Reference the instance variable with the "@" notation from within the class:
or referencing the instance variable with the getter representation:
Likewise the setter variant:
Reference the instance variable with the "@" notation from within the class:
or referencing the instance variable with the getter representation:
The text was updated successfully, but these errors were encountered: