问题描述
一切都在标题中:)
ObjC中是否有模板?
Is there any templates in ObjC ?
的C#:
public class MyClass<T> : Message
在ObjC中。
帮助会强烈地感谢:(
Any helps will be strongly thanks :(
推荐答案
没有这样的ObjC功能ObjC ++存在,我强烈反对它的广泛使用。它有很多问题,从不良的工具和调试器支持,到不良的编译器优化,恶化的ARC性能。
There is no such ObjC feature. While ObjC++ does exist, I strongly discourage its broad use. It has many problems from poor tool and debugger support, to poor compiler optimization, to degraded ARC performance.
通常模板不需要ObjC,因为它不是一个强类型语言。 NSArray
可以容纳任何对象,所以你不需要使用模板来获得正确的类型。你有一个特定的问题,解决?有一个更好的ObjC解决方案。
Generally templates are not required in ObjC because it is not a strongly typed language. An NSArray
can hold any object, so you don't need to use a template to get the right type. Do you have a specific problem you're trying to solve? There is likely a better ObjC solution.
这篇关于模板在目标C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!