summaryrefslogtreecommitdiffhomepage
path: root/c++.html.markdown
diff options
context:
space:
mode:
authorAlva Connor Waters <connor_waters@hotmail.com>2015-10-02 15:55:05 +0000
committerAlva Connor Waters <connor_waters@hotmail.com>2015-10-02 16:10:22 +0000
commit455afa3a7bf59fc272f3439825da55659765eec0 (patch)
tree2997facb27d4931bea20617b8c58ecaa55164863 /c++.html.markdown
parentae86e4ebabb0c78c1bd8052e6ab5916446ef39c2 (diff)
More explanation on virtual destructors
Diffstat (limited to 'c++.html.markdown')
-rw-r--r--c++.html.markdown5
1 files changed, 4 insertions, 1 deletions
diff --git a/c++.html.markdown b/c++.html.markdown
index 1cf5508a..b59635f5 100644
--- a/c++.html.markdown
+++ b/c++.html.markdown
@@ -349,7 +349,10 @@ public:
// These are called when an object is deleted or falls out of scope.
// This enables powerful paradigms such as RAII
// (see below)
- // Destructors must be virtual to allow classes to be derived from this one.
+ // Destructors should be virtual if a class is to be derived from;
+ // if they are not virtual, then any resources allocated using RAII in
+ // the derived class will not be released if it destroyed through a
+ // base-class reference or pointer.
virtual ~Dog();
}; // A semicolon must follow the class definition.