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 gives the current position of the put pointer?
In a function declaration, what does extern mean?
How would you differentiate between a pre and post increment operators while overloading?
Explain how functions are classified in C++ ?
Write my own zero-argument manipulator that should work same as hex?
Explain about vectors in c ++?
If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?
How does com provide language transparency?
What is c++ coding?
What do you mean by vtable and vptr in c++?
Explain data encapsulation?
How can you quickly find the number of elements stored in a dynamic array?
I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.
What is vector pair in c++?
What jobs can you get with a c++ certification?