Is it possible to set this on null?

Zarathustra adam.chrapkowski at gmail.com
Wed Aug 6 10:51:04 PDT 2008


class CFoo{
  public void destroy(){ delete this; } // ok
  public void forget(){ this = null; }   // ok but no effect
}

void
main(){
  auto l_fooA = new CFoo;
  
  auto l_fooB = l_fooA;
  l_fooA.forget; // no effect
  l_fooA = null;  // now ok

  l_fooB.destroy;  // ok 
}


More information about the Digitalmars-d-learn mailing list