Avoiding virtual methods in constructor
<p>Say I have the following class hierarchy:</p>

<pre><code>class Base
{
   virtual int GetClassID(){ return 0;};
public:
   Base() { SomeSingleton.RegisterThisObject(this-&gt;GetClassID());
}

class Derived
{
   virtual int GetClassID(){ return 1;};
public:
   Derived():Base(){};
}
</code></pre>

<p>Well, it's all simplified from my real case, but that's the general gist of it. </p>

<p>I want to avoid having to call RegisterThisObject in the constructor of each derived class, so I'm trying to move the call to the constructor of the base class. </p>

<p>Is there any pattern that I can use to acomplish this without using the virtual method in the constructor? </p>
