title: Virtual function call in constructor
body: <p>I have this layout</p>
  
  <pre><code>class Base {
     public:
     virtual void Initialize() { // base Implementation }
     Base() { Initialize(); }
  };
  
  class der_1 : public Base
  {
      public:
      der_1() : Base() {}
      virtual void Initialize() { // der_1 Implementation }
  };
  
  class der_2 : public Base
  {
      public:
      der_2() : Base() {}
      virtual void Initialize() { // der_2 Implementation }
  };
  </code></pre>
  
  <p>Now, whenever I create a new object of class der_1 or der_2, I will end up calling the base implementation of Initialize(). Apparently, I can't call a virtual function while the object is being created.</p>
  
  <p>As of now, I am calling the Initialize function after I create the object of type der_1 or der_2, which doesn't seem a correct practice to me as that will couple the Initialize function call to each time an object is created.</p>
  
  <p>Can someone suggest me better alternatives?</p>