c++ - Statically Init a derived class -


With C ++, is there a way for the derived class to obtain their own stable initial heir? I am trying to do something like the following:

  class base {public: class StaticInit {public: virtual StaticInit () = 0; }; }; Category received: Public base {Public: Virtual StaticInit :: StaticInit () {// Do something with derived class} Static Static Insights Init; } Fixed Generation: StaticInit init;  

It would also be good if I do not need to define init var in each derived class. I am currently redefining the StaticInit internal range in each derived class, but it is redundant.

Each derived class is a singleton, and I need to store this program in a lookup table at startup.

I use a template to do this, instead of inheriting - something like this:

< Pre> template & lt; Typename T & gt; StaticInit {StaticInit ()} {/} whatsoever with T}};

is in use:

  Fixed constrained; & Lt; SomeClass & gt; in this;  

Comments