Let\'s say I have some base abstract class and three different classes that derive and implement its methods. Is there is a \'Type\' object like as in C#? Or in other words, how
In addition to other answers, you might generate some C++ code doing what you want. Consider for example using GPP from your build automation tool (e.g. Makefile
) or write a simple AWK, Guile, or Python script doing what you want (or some ad-hoc C++ generator above ANTLR, inspired by SWIG), and generating some C++ code per your needs. My obsolete GCC MELT did that (dynamically, at runtime) on Linux.
Qt has a meta-object protocol doing exactly this. You might get inspiration from its moc (which is open source) generating C++ code.
Look also into the ongoing (but -in February 2020- embryonic) RefPerSys project. We want to use these ideas, and we are starting to implement them. Observe that on Linux dlopen
could be called thousands of times in practice, on shared objects produced by compilation of generated and temporary C++ code.