Answer Posted / meet
Constructor cannot be virtual. Because C++ is statically typed language. It is meaningless to the C++ compiler to create the object polymorphically. But it is possible to achieve behaviour like virtual constructor. This can be done by using factory design pattern.
Visit this link to know more about virtual constructor:
http://www.geeksforgeeks.org/advanced-c-virtual-constructor/
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is data binding in c++?
Explain storage qualifiers in c++.
why and when we can declar member fuction as a private in the class?
What is guard code in c++?
Are strings immutable in c++?
How to tokenize a string in c++?
What is polymorphism & list its types in c++?
Why struct is used in c++?
How do you instruct your compiler to print the contents of the intermediate file showing the effects of the preprocessor?
When should you use global variables?
How do I tokenize a string in c++?
What is object oriented programming (oop)?
Can c++ do everything c can?
What is an object in c++?
Why was c++ made?