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
Is c++ primer good for beginners?
What is ios in c++?
What is c++ prototype?
Is map sorted c++?
What do you mean by const correctness?
explain the reference variable in c++?
What is a list c++?
Why c++ is called oop?
What is boyce codd normal form in c++?
What are advantages of c++?
What is meant by entry controlled loop?
Does c++ have a hash table?
What are the differences between the function prototype and the function defi-nition?
Explain friend class?
What is the use of main function in c++?