top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

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

+1 vote
202 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...