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 an inline function in c++?
What is encapsulation in c++?
What is scope in c++ with example?
What is the purpose of templates in c++?
What is a dynamic binding in c++?
What is one dimensional array in c++?
Why is c++ called oops?
Explain the concept of dynamic allocation of memory?
What is a volatile variable in c++?
What is late binding c++?
What is helper in c++?
What is singleton class in c++?
Why is main function important?
Describe the role of the c++ in the tradeoff of safety vs. Usability?
What is the use of seekg in c++?