objective c - What is the difference between declaring a member in the extended interface versus in the implementation? -
I think I was really looking for two very different behaviors for the same.
Define my personal members in this class extension:
@interface class A () @ property classbie * b; @xm @ interpretation class - (classa *) init with class B: (classby *) newbie {self.b = newbie; Self return; } - (class B *) getB {return self.b; }
or define my personal member in such a class implementation:
@interface sqi (@ @ @ @ applyingment class A class B * B; - (Classes *) initWithClassB: (Class B *) newB {b = newB; Self return; } - (Class B *) getB {return b; }
The way I am using this code, I create classbie objects, initialize class objects with classb objects, and then add class objects to variable colors
- (zero) init {self.classAList = [[NSMUTABARARROL] INIT]; [Self. Classist Aid Object: [[Class A Alok] Initwthclass B: [Self Built Class B1]];; [Self. Classist Aid Object: [[Class A Alok] Initwathclass B: [Self-Made Class B2]];; [Self. Classlist Aid Object: [[Class ALLO] Initwthclass B: [Self Built Class B3]]]; } - Create (Classbie) Classes B1 {Classb * Class B = New ClassB (); // something init return class B;
When I first use the approach, and define my member in the interface detail, then I see that every element in my destructive array is actually what I expect .
However, using the second approach, I see that I should also mention that Classbie object is a C ++ object and that classb * b
indicator classb
object, when the - (zero) init
method expires, in every ClassA
objects Classb
Points indicates ClassB
is an object Object-c ++ class
In your second snippet, the b
file scope There is only one global variable in The fact is that it is inside the @implementation ... @end
is irrelevant, it is not a frequency variable and an asset.
Comments
Post a Comment