Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Template in Objective C?

Everything is in the title :)

Is there any templates in ObjC ?

I need equivalent of c# :

public class MyClass<T> : Message

in ObjC .

Any helps will be strongly thanks :(

like image 605
UIChris Avatar asked Apr 06 '12 12:04

UIChris


1 Answers

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.

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.

like image 193
Rob Napier Avatar answered Oct 07 '22 20:10

Rob Napier