Instance variables: access directly vs. getter / setter
Instance variables: access directly vs. getter / setter
- Subject: Instance variables: access directly vs. getter / setter
- From: Matthias Arndt <email@hidden>
- Date: Fri, 9 Oct 2009 11:01:52 +0200
While restructuring some old classes I'm uncertain about the preferred
way to access instance variables within their own instance:
I tend to defines all these variables as properties and use their
implicit getters / setters, but ...
1. ) ... in the designated initializer I have to access the instance
variables directly, because at this moment "self" is not yet defined,
is it?
2.) ... are there significant performance issues or other reasons to
prefer the direct reference to (or direct assignment of) instance
variables? At least the code of the setters / getters might impact the
performance, but I'd sacrifice it for the sake of a consistent code.
Any comments / suggestions?
Matthias
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden