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
Do class declarations end with a semicolon?
Write a program to show polymorphism in C++?
Which c++ compiler is best?
Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?
Is c better than c++?
In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....
What is functions syntax in c++?
State the difference between pre and post increment/decrement operations.
Show the declaration for a static member variable.
When does the c++ compiler create temporary variables?
Explain what data encapsulation is in c++?
Assume studentNames and studentIDs are two parallel arrays of size N that hold student data. Write a pseudocode algorithm that sorts studentIDs array in ascending ID number order such that the two arrays remain parallel.
Tell me what are static member functions?
What is the exit function in c++?
What is the difference between object-oriented programming and procedural programming?