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 are pointer-to-members? Explain.
If a function doesn’t return a value, how do you declare the function?
Differentiate between a pointer and a reference with respect to c++.
What is binary search in c++?
What is a virtual destructor? Explain the use of it?
Write a note about the virtual member function?
What is the history of c++?
Which ide is best for c++?
Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .
What is the difference between function overloading and operator overloading?
How much maximum can you allocate in a single call to malloc()?
What is array in c++ example?
Explain container class.
Can we use pointers in c++?
What is virtual base class uses?