How to construct virtual constructor
Answer Posted / nishant
Firstly Virtual constructor is really not needed at all.
Explanation:
V-table is something which stores the addresses corrospond
to all virtual function within a class.Now every class
object contains virtual pointer points to base address of
v-table in memory which is being used to resolve the
corrosponding virtual function addresses.
This v-table construction is done when object of the class
has been created,While constructor is an initialization
process in construction of the object and so v-table is not
available during initialization process and hence virtual
constructor is not possible.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What are the two types of comments?
What are the five basic elements of a c++ program?
Can we distribute function templates and class templates in object libraries?
How the keyword struct is different from the keyword class in c++?
Why we use #include iostream in c++?
Is vector a class in c++?
What is class invariant in c++?
What does the linker do?
What is the use of seekg in c++?
the first character in the variable name must be an a) special symbol b) number c) alphabet
What is the best way to take screenshots of a window with c++ in windows?
Which one is a preferred language C or C++? Why?
What is a .h file c++?
Is c++ a good beginners programming language?
Who was the creator of c++?