> The forward declaration is used to tell the compiler: "The word MyClass 
> represents a class. I don't give you the implementation yet, but it 
> represents a class, and the implementation will be provided later".

…and this allows you to create a property for an instance of that class in the 
.h that has the @class forward declaration. This way, you don't need to put 
#import class.h in there. You will need to include that last line in the .m in 
order for the property to work. So, in essence, you are putting your #import 
statement in the implementation and use the @class in the interface in order to 
reference its iVars in the .h

This is all done for performance reasons


 



Op Mar 21, 2013, om 10:20 PM heeft Jean Suisse <jean.li...@gmail.com> het 
volgende geschreven:

> A few minutes search gave me this. While I haven't taken a deep look to these 
> resources, they do look good.
> 
> - What's a forward declaration ? (several languages including Obj-C)
> http://en.wikipedia.org/wiki/Forward_declaration
> 
> - When to use a forward declaration (C++):
> http://stackoverflow.com/questions/553682/when-to-use-forward-declaration
> 
> - Objective C Programming Tutorial | Using @class And #import Directives
> http://www.youtube.com/watch?v=0b9Qok2uHhU
> 
> @class allows you to declare a class.
> Example: @class MyClass;
> 
> The forward declaration is used to tell the compiler: "The word MyClass 
> represents a class. I don't give you the implementation yet, but it 
> represents a class, and the implementation will be provided later".
> 
> Jean
> 
> On 21 mars 2013, at 21:43, H Miersch <hmier...@me.com> wrote:
> 
>> hi.
>> 
>> what exactly does @class do?
>> 
>> and what does "forward declaration" mean?
>> _______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/jean.lists%40gmail.com
>> 
>> This email sent to jean.li...@gmail.com
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/diederik%40tenhorses.com
> 
> This email sent to diede...@tenhorses.com
> 


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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

This email sent to arch...@mail-archive.com

Reply via email to