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++ platform dependent?
What is the most powerful coding language?
What is code reusability in c++?
What is the difference between a type-specific template friend class and a general template friend class?
Can a program run without main in c++?
Specify different types of decision control statements?
Explain rethrowing exceptions with an example?
How one would use switch in a program?
Is swift better than c++?
What is the meaning of c++?
What does flush do c++?
What are the 3 levels of programming languages?
Should I learn c or c++ first?
What is the use of c++ programming language in real life?
What is the difference between #define debug 0 and #undef debug?