Quote Originally Posted by moffy View Post
I have been thinking about the differences that result from as you mentioned C++ which is OOP and C which is function based. In C++ it makes good sense to hide internal structures and procedures and only expose the public methods of the class because the "class" encapsulates not only the code but the data.
C++ is not just object oriented; it's multi-paradigm. Procedural and generic programming is also fully supported by C++. There are many C++ libraries that are header-only, notably the Boost libraries. When you make heavy use of templates, the guidelines for header use change. That's why I said the interpretation depends on the programming paradigm being used, rather than the programming language being used.
Quote Originally Posted by moffy View Post
In C it's a bit different as long as you are not writing a LIB or DLL, in which you only expose the public functions. But in a C project, one for internal use rather than public, you tend to have unrestricted access to all functions and data. For an embedded project this can greatly speed up the code as you are not restricted to a class I/O function. I am probably not expressing this as fully as I would like nor as accurately but I hope you can discern my meaning.
In C, it is also possible to emulate the use of public/private functions by hiding a struct definition from the header file.
Code:
// header file
struct Example;

Example* CreateExample(int a); // emulate c'tor
void ReleaseExample(Example* pThis); // emulate d'tor
int ExampleFoo(Example* pThis, int b); // emulate member function

// .c file
struct Example
{
    int a;
};

Example* CreateExample(int a)
{
    Example* p = (Example*)malloc(sizeof(Example));
    p->a = a;
    return p;
}
// etc.