Can we call a virtual function from a constructor?
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 |
Can we call C++ OOPS? and Why
What is a virtual function in C++?
How does stack look in function calls? When does stack overflow? What can you do to remedy it?
Is there a difference between class and struct?
What is the difference between member functions and static member functions?
What is the difference between virtual functions and pure virtual functions?
Write a C++ Program to find Square Root of a number using sqrt() function.
Write a C++ Program to Find whether given Number is Odd or Even.
What does it mean to declare a member function as static in C++?
What is the purpose of a constructor? Destructor?
dynamic scoping is
When must you use a constructor initializer list?