* Shimin:
Jerry Coffin wrote:
>In article <11**********************@a14g2000cwb.googlegroups .com>,
da*************@gmail.com says...
>>I wonder if there is any reasonable reason to make virtual destructor
protected within a derived class purposely?
A virtual protected dtor will normally be accompanied by a static
member function to create objects. The dtor is protected to prevent
outside code from creating instances of the class without using the
static member function to create them. Making it virtual and protected
means this is intended to be used as a base class.
Are you confusing _dtor_ with _ctor_?
No, he's confusing two different schemes for ensuring dynamic
allocation: (1) using factory factions, and (2) using protected or
private destructor, where the main advantage is that you /don't/ have to
create a factory function per constructor.
See section 1.1.3 of <url:
http://home.no.net/dubjai/win32cpptut/special/pointers/ch_01.pdf>.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?