Explain calling an object's member function(declared
virtual)from its constructor?



Explain calling an object's member function(declared virtual)from its constructor?..

Answer / deepak

It will depend on when pointer to vtable is initialised.
generally if constructor is already defined compiler insert
code to initialise virtual table pointer as first statement
inside defined constructor. If vptr is initialised before
calling virtual function then it will be invoked, if vptr is
not initialised then it can crash.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C++ General Interview Questions

How would you use the functions randomize() and random()?

0 Answers  


What is a smart pointer?

1 Answers  


How do you show the declaration of a virtual constructor?

0 Answers  


Which operator can not be overloaded in C++?

1 Answers  


program in c++ to input digits and print in words

1 Answers   Microsoft,






Differentiate between the message and method in c++?

0 Answers  


Is it possible to provide special behavior for one instance of a template but not for other instances?

0 Answers  


What is the Difference between "C structure" and "C++ structure"?

12 Answers  


What is searching?

0 Answers  


What does ios :: app do in c++?

0 Answers  


Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be

0 Answers  


State the difference between pre and post increment/decrement operations.

0 Answers  


Categories