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 |
What is difference between class and function?
Find the second maximum in an array?
What is c++ hiding?
Write any small program that will compile in "C" but not in "C++"?
what are the iterator and generic algorithms.
What are virtual constructors/destructors?
In C++ cout is: a) object b) class c) something else
11 Answers Infosys, Lehman Brothers,
What is the purpose of the noexcept keyword?
Can circle be called an ellipse?
What C++ libraries are you proficient with?
What data encapsulation is in c++?
What is conversion constructor?