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


Please Help Members By Posting Answers For Below Questions

A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

3451


what are the iterator and generic algorithms.

1890


What is functions syntax in c++?

819


Explain the differences between private, public and protected and give examples.

765


What is enum c++?

854


What are the various operations performed on stack?

816


Explain how the virtual base class is different from the conventional base classes of the opps.

892


What are the types of array in c++?

799


How to defines the function in c++?

819


what is the use of void main() in C++ language?

875


Is arr and &arr are same expression for an array?

799


Why do we use using namespace std in c++?

801


Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?

766


What is a character in c++?

764


What is lazy initialization in c++?

824