2 ms·
I would call this sort of code "C with namespaces and templates". Classes are definitely the least useful feature that C++ added on top of C.
by flohofwoe 3y ago
I would call this sort of code "C with namespaces and templates". Classes are definitely the least useful feature that C++ added on top of C.
- gpderetta 3y agothis is trivially true as classes are exactly the same as struct except for the default access. If you mean member functions, virtual functions and inheritance, I beg to differ.
- curt15 3y agoHow else would people do OOP in C? Use GObject and its macros and boilerplate?
- pokeymcsnatch 3y agostructs?
- JohnFen 3y agoThat's how I did it before C++ existed. Structs with pointers to functions (which is conceptually what C++ classes are).
- pokeymcsnatch 3y agoYarp, I do the same. It's rudimentary but works fine and the code is clean enough if you pick a couple conventions (starting "private" variables with an underscore for example) and stick with them.