Can we call a virtual function from a constructor?



Can we call a virtual function from a constructor?..

Answer / hrpynux@gmail.com

You can call a virtual function in a constructor, but be careful. ... In a constructor, the virtual call mechanism is disabled because overriding from derived classes hasn't yet happened. Objects are constructed from the base up, “base before derived”.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ Interview Questions

What is an abstract class?

5 Answers   Siemens,


How to run C++ program in cmd

0 Answers  


Explain the operator overloading feature in C++ ?

0 Answers  


What are issues if we mix new and free in C++?

0 Answers  


Declare a pointer to a function that takes a char pointer as argument and returns a void pointer.

0 Answers   Alter,






How to convert integer to string in C++

0 Answers  


How many times will this loop execute? Explain your answer.

0 Answers  


What does it mean to declare a member function as virtual in C++?

0 Answers   Amazon,


Can we call a virtual function from a constructor?

1 Answers  


What are pass by value and pass by reference?what is the disadvantage of pass by value?

0 Answers   Alter,


Difference between function overloading and function overriding.

0 Answers   Alter,


What is the difference between virtual functions and pure virtual functions?

1 Answers  


Categories