Cleaned up a code example comment

This commit is contained in:
hsutter
2019-01-17 09:38:14 -08:00
parent 373765b827
commit b38d065e45

View File

@@ -4923,7 +4923,7 @@ See [this in the Discussion section](#Sd-dtor).
##### Example, bad ##### Example, bad
struct Base { // BAD: no virtual destructor struct Base { // BAD: implicitly has a public nonvirtual destructor
virtual void f(); virtual void f();
}; };
@@ -4946,7 +4946,7 @@ If the interface allows destroying, it should be safe to do so.
##### Note ##### Note
A destructor must be nonprivate or it will prevent using the type : A destructor must be nonprivate or it will prevent using the type:
class X { class X {
~X(); // private destructor ~X(); // private destructor
@@ -4963,6 +4963,7 @@ A destructor must be nonprivate or it will prevent using the type :
We can imagine one case where you could want a protected virtual destructor: When an object of a derived type (and only of such a type) should be allowed to destroy *another* object (not itself) through a pointer to base. We haven't seen such a case in practice, though. We can imagine one case where you could want a protected virtual destructor: When an object of a derived type (and only of such a type) should be allowed to destroy *another* object (not itself) through a pointer to base. We haven't seen such a case in practice, though.
##### Enforcement ##### Enforcement
* A class with any virtual functions should have a destructor that is either public and virtual or else protected and nonvirtual. * A class with any virtual functions should have a destructor that is either public and virtual or else protected and nonvirtual.