Converting a C++ program into C#

c#, c++

Solution

The distinction between includes ".h files" and source ".cpp files" is only one of convention. The convention is that declaration (functions, classes, etc) are in .h files which are `#include`d in implementation (definition), or .cpp files. For most cases you're fine in collapsing X.h and X.cpp to a single X.cs file.

That said, you still need to take a look at what is going on in each file. A basic understanding of C++ would go a long way here, and something I strongly recommend you acquire before you get too far into your translation.

Problem

I'm working on a project where I'm converting C++ code to C# manually. I have working knowledge of C# but I've never used C++ before. What I need to know is how to deal with the header files, since C# does't have anything like that. Say I have buffer.h and buffer.cpp, would I just convert them both and include them in the same buffer.cs file? Is the C++ header file in any way related to an Ada spec file?

Original source