Consider the sample code given below and answer the question that follows.
class Person
{
public:
Person();
virtual ~Person();
};
class Student : public Person
{
public:
Student();
~Student();
};
main()
{
Person *p = new Student();
delete p;
}
Why is the keyword "virtual" added before the Person destructor?
Correct Answer: To ensure that correct destructor is called when p is deleted
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More C++ MCQ Questions