Reputation: 901
I have a parameterized class let us call it ParameterizedClass
. When I use it in a header file using forward declaration (@class ParameterizedClass;
) the compiler outputs this error Type arguments cannot be applied to non-parameterized class 'ParameterizedClass'
if I declare a property ParameterizedClass<Type>
.
How can I use parameters while still using forward declaration without importing the class's header?
Upvotes: 1
Views: 379
Reputation: 2661
If I understand correctly you're trying to declare a property of type ParameterizedClass<Type>
in your header and the compiler complains because all the only declaration of ParameterizedClass
it knows is non-parameterized (i.e. @class ParameterizedClass;
.)
I suggest you change your forward declaration to @class ParameterizedClass<T>;
You'll then be able to declare your property :
@property (strong, nonatomic) ParameterizedClass<Type *> * property;
Upvotes: 1