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

Define namespace.

1 Answers  


Explain the difference between C and C++.

0 Answers   Accenture,


What is conversion constructor in C++

0 Answers   TCS,


C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.

0 Answers  


Write a C++ Program to Reverse a Number using while loop.

1 Answers  






What is Copy Constructor?

5 Answers   ABC, Siemens,


What Is A Conversion Constructor C++ ?

0 Answers   Amazon,


What does it mean to declare a function or variable as static?

0 Answers   Amazon,


Explain function prototypes in C++.

0 Answers   Aricent,


What is the 4 difference between delete[] and delete?

0 Answers   Alter,


What is pass by value & reference.

0 Answers   Accenture,


What are the fundamental features of an object-oriented language?

0 Answers   Accenture,


Categories