top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Is it possible to have Virtual Constructor in C++? If yes, how? If not, then why not?

+1 vote
654 views
Is it possible to have Virtual Constructor in C++? If yes, how? If not, then why not?
posted Dec 6, 2014 by Alwaz

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
 
Best answer

NO,There is nothing like Virtual Constructor in C++.

REASON:
The Constructor can’t be virtual as the constructor is a code which is responsible for creating an instance of a class and it can’t be delegated to any other object by virtual keyword means.

answer Dec 8, 2014 by Mohammed Hussain
+1 vote

No.. Constructor can not be Virtual.

Because,
Constructor can not be INHERITED.
But through the object of child class we can use parent class constructor.
If parent class's constructor is parameterize then child class constructor must me parameterize;

answer Dec 8, 2014 by Chirag Gangdev
...