Yahoo Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

Virtual destructor is used when you declare a base class pointer to derived class, and if you try to delete the pointer, it doesnt execute the derived destructor step. Destructor in base class is then made virtual to actually let the derived class destructor function call, and so it can free those variables in the derived class.

- Anonymous September 10, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

See the concept of Virtual Destructor comes into picture when atleast one of the functions in the base class is a virtual function i.e it is intended to have another implementaton in the derived classes. Then it is the need to make the destructor virtual. As if this is not the case then every time even if the Base class pointer is used to create a derived class object .. then also on completion only base classs destructor would be called. For this reason we have a virtual destructor in the base class which allows us to get the corresponding derived class destructor called whose object was maded through base class pointer

- Kush T June 17, 2009 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More