Ok, my friend is wrong.  I thought that.

2011/4/25 Patrick Mau <[email protected]>

> Hallo Rodrigo
>
> The "@class" statement is a forward declaration to tell the compiler that
> the class exists.
> It provides no additional information to the compiler, meaning that code
> completion will not work.
>
> You probably should consider protocols, it's hard to judge from your
> sample.
>
> Patrick
>
> On 25.Apr.2011, at 17:02, Rodrigo Zanatta Silva wrote:
>
> > HI, someone said to me that *@class* directive create a new instance of
> the
> > class automatic. I tried to find information about this, but didn't
> found.
> >
> > For me, @class is only to solve cyclic includes. There are any side
> effect
> > using it? The object variable is the same in this 2 example below, or
> there
> > are some difference? The instance *instanceMyClass* will be the same of
> the
> > class that send the pointer, right? And I will not lose any memory right?
> >
> > Example 1
> > //in sample.h
> > #include "myClass.h"
> >
> > myClass *instanceMyClass;
> >
> > //in sample.m
> > #include "sample.h"
> > -(id) initWithMyClass :(myClass *) linkMyClass {
> >    instanceMyClass = linkMyClass;
> > }
> >
> > Example 2
> > //in sample.h
> > @class myClass;
> >
> > myClass *instanceMyClass;
> >
> > //in sample.m
> > #include "sample.h"
> > #include "myClass.h"
> >
> > -(id) initWithMyClass :(myClass *) linkMyClass {
> >    instanceMyClass = linkMyClass;
> > }
>
>
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to