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

What is the difference between a type-specific template friend class and a general template friend class?

0 Answers  


Explain data encapsulation?

0 Answers  


if i want cin 12345678910 and cout abcdefghij. so how can i create the program?. example : if i key in 8910 so the answer is ghij.

3 Answers  


Please explain the reference variable in c++?

0 Answers  


What is a "RTTI"?

6 Answers   HCL,






What is atoi?

0 Answers  


What is the most useful programming language?

0 Answers  


write asingle linked list which read from two list & the do the following 1 sort the prime & nonprime num (prime should be less tn nonprime) 2 each node has a prime num followd by nonprime 3 add a new node into its sutable plce 4 erase the most three duplicated non prime num 5 find the least duplicated prime num

0 Answers   Care,


what is importance of data sturture in a programming language?

22 Answers   L&T, TCS, Wipro,


What is a map in c++?

0 Answers  


What is a syntax in c++?

0 Answers  


Can we inherit constructor in c++?

0 Answers  


Categories