I this post we have provided part 3 of the most common C++ interview questions along with answers. We recommend you to try to answer the questions, before referring to the given answer. If you find any mistake or a better alternate solution we are happy to see your suggestions and comments

1.  What is the storage class of virtual function table?

Ans : static

2. When is the virtual function table created?

Ans : During compilation of the class defenition

3. What is virtual pointer?

Ans : Hidden member of class object pointing to the corresponding virtual function table

4. When is virtual pointer created?

Ans : During instantiation of a object

5. How to use virtual constructor?

Ans : There is no support for virtual constructor in C++

6. Why virtual constructor is not supported?

Ans : The virtual pointer in itself is created after the execution of constructor hence if constructor is made virtual there is no way in the run time to find which constructor to invoke

7. How to use virtual destructor?

Ans : Like any other virtual function during declaration the destructor should be declared with the virtual keyword.

8. Can a destructor be pure virtual?

Ans : Yes

9. What is the difference between pure virtual function and pure virtual destructor?

Ans : Function definition is optional for pure virtual function but is mandatory for pure virtual destructor. Without definition for pure virtual destructor there will be a liker error.

10. Can a destructor be overloaded?

Ans : No