What does @class do in Objective-C?

前端 未结 4 2006
清酒与你
清酒与你 2020-12-12 16:06

Can anyone please explain me what does @class declaration do in Objective-C and what are the cases in which we should use this declaration?

4条回答
  •  有刺的猬
    2020-12-12 16:42

    hope this will help little more

    Above answer already state almost every thing , i would like to add some thing on it.

    The @class Foo is a forward declaration of the Foo class. It’s like telling the compiler, foo class exists So don't bother about it right now.

    Note:- Class declaration becomes very critical when both class need each other. if we do usual #import statement then, we would have an endless loop of imports and Compilers don’t like endless loops. So we use @class Classname.

提交回复
热议问题