destructors

Bill Baxter dnewsgroup at billbaxter.com
Tue May 1 17:22:07 PDT 2007


Daniel Keep wrote:
> 
> Daniel Giddings wrote:
>> Daniel Keep wrote:
> The other thing I started doing in some of my code was to use the following:
> 
> interface Disposable
> {
>     void dispose();
> }
> 
> void dispose(Object obj)
> {
>     if( auto dobj = cast(Disposable)obj )
>         dobj.dispose();
> }

Why not follow up the call to dispose with a 'delete dobj'?
Would that make 'scope' fail?


--bb


More information about the Digitalmars-d-learn mailing list