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
Why do we use classes in programming?
What is flush c++?
Which one is better- macro or function?
When do we run a shell in the unix system? How will you tell which shell you are running?
What are vectors used for in c++?
Explain about vectors in c ++?
What are the manipulators in c++?
How can I improve my c++ skills?
What is the use of 'this' pointer?
Program to check whether a word is a sub-string or not of a string typed
How are virtual functions implemented in c++?
Which operator cannot be overloaded c++?
What is meant by forward referencing and when should it be used?
What are manipulators used for?
Define a constructor?