0
Why C++ doesn't have virtual constructor?
I have googled many times to find the answer of this question... but never found a satisfactory answer. Can anyone answer - Why C++ doesn't have virtual constructor?
1 Antwort
0
Virtual allows us to call a function without knowing the exact type of the object.
In order to construct something you need to know the exact type, thus a constructor cannot be virtual.
More on this here:
http://www.stroustrup.com/bs_faq2.html#virtual-ctor