Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From <a href="http://www.research.att.com/~bs/bs_faq2.html#virtual-dtor" rel="noreferrer">Stroustrup's C++ Style and Technique FAQ</a>:</p> <blockquote> <p>So when should I declare a destructor virtual? Whenever the class has at least one virtual function. Having virtual functions indicate that a class is meant to act as an interface to derived classes, and when it is, an object of a derived class may be destroyed through a pointer to the base.</p> </blockquote> <p>Lots of additional info on <a href="http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.7" rel="noreferrer">when your destructor should be virtual on the C++ FAQ</a>. (thanks Stobor)</p> <p>What is a virtual member? From the <a href="http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.1" rel="noreferrer">C++ FAQ</a>:</p> <blockquote> <p>[20.1] What is a "virtual member function"?</p> <p>From an OO perspective, it is the single most important feature of C++: [6.9], [6.10].</p> <p>A virtual function allows derived classes to replace the implementation provided by the base class. The compiler makes sure the replacement is always called whenever the object in question is actually of the derived class, even if the object is accessed by a base pointer rather than a derived pointer. This allows algorithms in the base class to be replaced in the derived class, even if users don't know about the derived class.</p> <p>The derived class can either fully replace ("override") the base class member function, or the derived class can partially replace ("augment") the base class member function. The latter is accomplished by having the derived class member function call the base class member function, if desired.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload