The first is the code that OC calls C++.
Create an Objective-C project and create c++ files MyCppFile.hpp and MyCppFile.cpp.
Change the file name of the Cpp code to be called to the mm suffix name. The structure of the project code is as follows:
The code that implements the C++ part:
MyCppFile.hpp
MyCppFile.cpp
The C++ header file can be called by introducing the C++ header file in main.mm:
Then C++ calls OC
Create OC related files first, and then change *.m to *.mm.
The header file is written in C format
MyOCFile.h
Write a concrete implementation in OC.
Similarly, it can be called by introducing header files in C++.
The call between OC and C++ is simpler than expected. The key here is to change the extension of the OC file to *.mm.