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
Explain abstraction.
Is it possible for a member function to use delete this?
What are pointer-to-members in C++? Give their syntax.
When should overload new operator on a global basis or a class basis?
How do you generate a random number in c++?
What is problem with overriding functions?
what is data encapsulation in C++?
What does it mean to declare a member variable as static?
Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).
How many namespaces are there in c++?
What is pointer to member?
What is an operator function? Describe the function of an operator function?
Why are pointers not used in c++?
Define macro.
How can I disable the "echo" feature?