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 setfill c++?
What is the average salary of a c++ programmer?
Why do we need c++?
What are the implicit member functions of class?
Where can I run c++ program?
Is c++ the hardest programming language?
What is low level language in simple words?
Const char *p , char const *p What is the difference between the above two?
which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?
What does extern mean in a function declaration in c++?
What is the use of typedef?
Define the process of handling in case of destructor failure?
Can a class be static in c++?
Can create new c++ operators?
Program to check whether a word is a sub-string or not of a string typed