Objective-C ++ for iOS development

Can I use Objective-C ++ to develop iOS applications (iPhone, iPad, iPod touch)?

Are there any examples and source code on the Internet?

+7
source share
2 answers

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).

+13
source

Yes, you can. Take a look at the samples and new file templates that Apple provides.

0
source

All Articles