Quote:
Originally Posted by
amitpansuria
can u explain me in simple term that why constructor cannot be virtual
Virtual works by the object pointing to a v-table, and the caller dereferencing the call via the v-table. Immediately prior to construction time you don't have an object which points to a vtable to make the call.
Solutions to this include using factory objects, which is exactly what COM does with IClassFactory so the call to CreateInstance is virtual. Similarly IBM's SOMClass::somNew.