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 are friend functions in C++?
If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?
Explain the differences between private, public and protected and give examples.
What are the implicit member functions of class?
Is c++ a high level language?
What is a breakpoint?
Which c++ compiler is best?
What are member functions used in c++?
What jobs can you get with a c++ certification?
Differentiate between realloc() and free().
Explain Memory Allocation in C/C++ ?
Why is main function important?
What are the advantages of c++ over c?
How many types of scopes are there in c++?
What are the extraction and insertion operators in c++?