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 is the difference between the functions memmove() and memcpy()?
How many standards of c++ are there?
What is copy constructor? Can we make copy constructor private in c++?
What are the various operations performed on stack?
What is the difference between method overloading and method overriding in c++?
How many types of classes are there in c++?
What is the difference between a definition and a declaration?
Describe the role of the c++ in the tradeoff of safety vs. Usability?
Which one is a preferred language C or C++? Why?
Write a struct time where integer m, h, s are its members?
What are the defining traits of an object-oriented language?
What are the comments in c++?
What is the difference between while and do while loop? Explain with examples.
What is #include iomanip?
What is the best c++ book for beginners?