orting C code to C++ is no big deal: change the source file's extension from .c
and recompile. By contrast, porting C++ source code and binaries to C requires more elbow grease and midnight oil. The following sections show how the two languages can share a single declaration of a class with member functions and other C++ goodies. Then you'll see how C apps can utilize state-of-the-art C++ algorithms and containers with a little help from the linker.
You have a class that declares member functions but you want to use it in a C app as well. Additionally, you want to simplify the implementation of certain tasks in your C app by utilizing C++ algorithms and containers. How do you accomplish these goals?
Use conditional compilation to hide C++ features from a C compiler and wrap compiled C++ code in a C-callable function.