Monday, May 14, 2012

In Objective-C, we can put the instance variables in the @implementation section?

I have always put the instance variables in the interface .h file, but just saw some code doing this:



@implementation Fraction  {
int numerator;
int denominator;
}


which is to move the instance variables to the implementation side. It works too, but since when can we do it (or can we always do it with Objective-C), and I suppose it is better because what instance variables we use is not really part of an interface.





No comments:

Post a Comment