From: sk.smawsk on
Hi,

Can there be any use of "Pure Virtual Destructor"?
If yes, then in what scenario do we use it?

Thanks in advance.

Warm Regards.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: peter koch larsen on
On 6 Mar., 11:14, sk.sma...(a)gmail.com wrote:
> Hi,
>
> Can there be any use of "Pure Virtual Destructor"?
> If yes, then in what scenario do we use it?
You can, but I see no reason to have one - except perhaps for one
bizarre situation where the destructor is the main theme of the class.
Keeping it virtual and empty is sufficient.

/Peter


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Maciej Sobczak on
sk.smawsk(a)gmail.com wrote:

> Can there be any use of "Pure Virtual Destructor"?

Sure.

> If yes, then in what scenario do we use it?

For deleting object through their abstract interface?

It might be a valid solution for home-made synchronous garbage
collectors or other on-demand mechanisms for deleting groups of objects,
for example.


--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Sebastian Redl on


On Tue, 6 Mar 2007 sk.smawsk(a)gmail.com wrote:

> Hi,
>
> Can there be any use of "Pure Virtual Destructor"?
> If yes, then in what scenario do we use it?
>

You can. The purpose is to mark a class as abstract that has no other pure
virtual functions.

Note that you can still provide an implementation even if the destructor
is pure virtual.

Sebastian Redl

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Andrew Koenig on
<sk.smawsk(a)gmail.com> wrote in message
news:1173171845.783991.214940(a)c51g2000cwc.googlegroups.com...

> Can there be any use of "Pure Virtual Destructor"?

Yes.

> If yes, then in what scenario do we use it?

I have trouble imagining one.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]