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
Explain rtti.
What do the header files usually contains?
What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.
What are the differences between the function prototype and the function defi-nition?
What is iterator in c++?
What are the benefits of oop in c++?
If dog is a friend of boy and boy is a friend of house, is dog a friend of house?
What is the difference between reference and pointer?
Why do we learn c++?
What does count ++ do in c++?
You run a shell on unix system. How would you tell which shell are you running?
What do you mean by delegate? Can a user retain delegates?
How would you use the functions memcpy(), memset(), memmove()?
What is a loop? What are different types of loops in c++?
What is the difference between the functions rand(), random(), srand() and randomize()?