cocoa - objective-c #import @class -


this question has answer here:

i can't use of #import , @class

let's try make things clear simple classical example: employee case.

i have class employee, class manager , class department.

employee superclass of manager , contain object department ( should import department? in employee.h or employee.m , should use #import or @class ? )

department contains array of employees should should import class employee.h ( should use import or class? , where? )

i know theres better way solve problem, using databases or that's not point, want understand when , use #import , , when use @class 

i tried read similar post didn't understand how works...

using @class hint compiler mean use class , can used when referencing class in kind of declaration. not import header file , therefore compile little faster. useful avoid circular inclusions.

using #import import header file during compilation , needed when relying on behavior of class in question. how compiler knows properties, methods, etc can used safely.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -