Constrained genericity: Difference between revisions
Content added Content deleted
(added objc) |
|||
Line 681: | Line 681: | ||
@end</lang> |
@end</lang> |
||
Type constraints in type parameters can be made via the <code>:</code> keyword, indicating in this case that the type argument must be a type that is a subtype of <code>id<Eatable></code>. |
Type constraints in type parameters can be made via the <code>:</code> keyword, indicating in this case that the type argument must be a type that is a subtype of <code>id<Eatable></code>. |
||
<lang objc>@interface FoodBox<T : id<Eatable>> |
<lang objc>@interface FoodBox<T : id<Eatable>> : NSObject |
||
@end</lang> |
@end</lang> |
||