How do you know that your class needs a virtual destructor?

Answer Posted / melos

If the class will be derived from and it will need a virtual
destructor so that the destructor of the derived class will
be invoked if it referenced using the pointer to the base class.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why c++ does not have finally?

583


What do you mean by persistent and non persistent objects?

728


What are the benefits of operator overloading?

673


What is const in c++?

588


Do class declarations end with a semicolon? Do class method definitions?

610






How does a copy constructor differs from an overloaded assignment operator?

549


What is the difference between while and do while loop? Explain with examples.

591


How do I write a c++ program?

590


What do you understand by a pure virtual member function?

538


Which of the following is evaluated first: a) && b) || c) !

1793


Explain rtti.

586


Which bit wise operator is suitable for turning off a particular bit in a number?

636


If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?

661


How do I use turbo c++?

545


What new()is different from malloc()?

565