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 classb * b indicator in the class object is always indicated recently This is for the classb object, when the - (zero) init method expires, in every ClassA objects Classb Points indicates ClassB

I should also mention that Classbie object is a C ++ object and that 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

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -