开发者

mvc with objective c and c++?

开发者 https://www.devze.com 2023-01-23 22:05 出处:网络
since I like 0 objective c syntax, I heard u can mix objective c and c++. So u will use objective c for UI and c++ for the application.

since I like 0 objective c syntax, I heard u can mix objective c and c++. So u will use objective c for UI and c++ for the application.

Can i have a code example of how to do this? I mea开发者_如何学JAVAn, on a button click even can i call a c++ method? How can I interact between c++ and objective c?

This may be usefull for an evantual porting to windows for example considering the core application is c++

Thanks


Start with the Objective-C Programming Language guide. In generall, you can mix Objective-C and C++ code within the same file. Keep in mind this hybrid language (Objective-C++) is much slower to compile and is a C++ superset whereas Objective-C is a C superset, so the usual C vs. C++ differences apply. In general, you are best served by creating an isolated Objective-C++ layer between your pure Objective-C code and your pure C++ code.

In answer to your direct question, the target/action of an NSControl cannot be a C++ class method. However, it can be an Objective-C++ class that forward the call to a C++ class method.

0

精彩评论

暂无评论...
验证码 换一张
取 消