Funkygoby wrote:edbarx wrote:In other words in C classes are structures containing all the data fields that would be placed inside a class with no visibility specifiers like private, public and published.
...
I believe you can separate private from public variables and methods with some thinking (and readings!!)
The funny thing is, that today's object programming theory and object-oriented languages are in general nothing more than reinventing the wheel - only the results are less efficient and less reliable, because they depend on high amount of the glue code generated by compilers, which will always have bugs and wchich will always be slower.
The translation unit in C
is a class - or at least it should be used like this, but unfortunately many people just don't get it.
For example:
1. Every static declaration in the unit means a "private" field or member function/method, but it can be also used for reference counting. Static members are invisible outside the unit.
2. Every non-static decalaration means "public".
3. Derivation, inheritance and polymorphism was available in C from its very beginning, since any data structure can be build with other data structures and extended by additional fields.
4. The header can be used to implement "protected" interface and "friend" classes by revealing parts of the interface, depending on who is including the header (using preprocessor symbols)
Regards.