Great workaround suggestions by some, but the existence of these workarounds proves my point that a language feature is superior. One can also accomplish OO-like behavior in C without C++, but the syntax of C++ is superior. Before C++ existed and a C programmer suggested classes and objects as a feature, once could argue "you don't need that, you can use function pointers in structs". Yes, "workarounds" exist but the whole point of language syntax is to incorporate it into the more simple and concise patterns of the language usage.
By the way, along with this feature, I also request a related feature for "const after init once". This related feature would be very helpful for objects that are conceptually intended to be global constants but one would like the chance the initialize them once (and only once) at runtime (typically in early startup time). So they are automatically const after they are initialized the first time.
So, in summary, the two features that I am requesting as a C++ customer are:
- Ctor-like re-init once-and-done special functions that are not available as normal functions after init just as ctor is not available as a normal function on an object.
- const after first init