Wilson Yuan
Wilson Yuan

Reputation: 35

How to declare a Class property in objective-c?

How to declare a Class property in objective-c?

Like this:

@property Class praise_usersClass;

it's right?

Upvotes: 1

Views: 1898

Answers (1)

Tim
Tim

Reputation: 9042

In Objective-C, Class is a pointer type and essentially also an object. So you can define a property as type Class just like any other object but you do not need to specify the pointer as it is part of the typedef definition.

Your example is fine:

@property Class praise_usersClass;

But FYI, note that you haven't specified any attributes so the defaults will apply:

@property (atomic,strong,readwrite) Class praise_usersClass;

For more information: Are classes structs or struct pointer

Upvotes: 1

Related Questions