Answer Posted / 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 View All Answers
What is & in c++ function?
Explain function overloading and operator overloading.
What is the use of pointer in c++ with example?
What is the use of oops?
How one would use switch in a program?
What is the difference between struct and class?
Can we specify variable field width in a scanf() format string? If possible how?
Explain shallow copy?
How would you implement a substr() function that extracts a sub string from a given string?
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?
State the difference between delete and delete[].
What is new in c++?
Explain the difference between class and struct in c++?
Show the declaration for a pointer to function returning long and taking an integer parameter.
Is map ordered c++?