Explain calling an object's member function(declared
virtual)from its constructor?
Answer Posted / 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 View All Answers
What is the difference between prefix and postfix versions of operator++()?
Explain virtual class and friend class.
What is virtual destructor ans explain its use?
Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?
Why do we use the using declaration?
Write about an iterator class?
how to connect with oracle 9i with server in socket program in c/c++
Can we use this pointer in a class specific, operator-overloading function for new operator?
Give an example of run-time polymorphism/virtual functions.
What is an object in c++?
Write a program which uses Command Line Arguments
What is iomanip c++?
What is the purpose of templates in c++?
Can member functions be private?
What are stacks? Give an example where they are useful.