Interviewer And Interviewee Guide

C++ Programmer Interview Question:

Explain me what is virtual destructors? Why they are used?

Submitted by: Muhammad
Virtual destructors are used for the same purpose as virtual functions. When you remove an object of subclass, which is referenced by a parent class pointer, only destructor of base class will get executed. But if the destructor is defined using virtual keyword, both the destructors [ of parent and sub class ] will get invoked.
Submitted by: Muhammad

Read Online C++ Programmer Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.