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
Does c++ have arraylist?
How do you establish a has-a relationship?
Explain the different access specifiers for the class member in c++.
What are the four partitions in which c++ compiler divides the ram?
Why is c++ considered difficult?
How do I run a program in notepad ++?
What is a list c++?
Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.
What is constructor c++?
What is an overflow error?
Why c++ is faster than java?
What is data abstraction? How is it different from data encapsulation?
What is constructor in C++?
What is c++ coding?
What does obj stand for?