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

Define the process of handling in case of destructor failure?

0 Answers  


What is the outcome of cout< a) 16 b) 17 c) 16.5

0 Answers  


What is private, public and protected inheritance?

0 Answers  


Why do we use string in c++?

0 Answers  


What is encapsulation in c++?

0 Answers  






Define a pdb file.

0 Answers  


Is c++ vector dynamic?

0 Answers  


What is the difference between multiple and multilevel inheritance in c++?

0 Answers  


What is the output of printf("%d")?

58 Answers   CTS, HCL, Infosys, TCS, Winit, Wipro,


Explain about Virtual Function in C++?

0 Answers  


What do c++ programmers do?

0 Answers  


Which software is used to run c++ program?

0 Answers  


Categories