Using ObjC ++ is pretty simple. You must declare source files with the extension .mm. This will force the compiler to treat them as ObjC ++. Same thing with headers: use the .hh extension.
There is another option: go to the settings of the target object and set the compilation sources Like Objective-C ++.
It's all. No extra work required.
Some notes: if you want to create your own iOS application, use Objective C. This will save a lot of time. But in some cases, using C ++ is more appropriate. For example. for cross-platform development. This way you only use a little Objective-C for iPhone or Java for Android to glue your code using the environment. Everything else is in C ++. I use this to develop a cross-platform game.
Another case is performance: Objective-C is generally slower than C ++. However, this is only noticeable during method calls (in ObjC this is called messaging).
Max
source share