GotW #5 Solution: Overriding Virtual Functions—Herb Sutter
 | The solution to GotW #5 is now available: by Herb Sutter From the article: Exactly one of the following can be true for a polymorphic type: - Either destruction via a pointer to base is allowed, in which case the function has to be
public and had better be virtual; - or else it isn’t, in which case the function has to be
protected (private is not allowed because the derived destructor must be able to invoke the base destructor) and would naturally also be nonvirtual (when the derived destructor invokes the base destructor, it does so nonvirtually whether declared virtual or not). |
Read More »
No comments:
Post a Comment