Internal delegate and Stack Overflow
    tsalm 
    tsalm at free.fr
       
    Fri Nov 28 15:35:27 PST 2008
    
    
  
Hello,
I would do something like this, but this return me an execution error :
object.Exception: Stack Overflow
// --------CODE--------
class A
{
  void delegate() dg;
  void doIt()
  {
   dg();
  }
}
class B
{
  A a;
  this()
  {
   a = new A;
   a.dg = { doSomething(); };
  }
  void doSomething() { }
}
void main()
{
  auto b = new B;
  b.a.doIt();
}
// ------END CODE------
Is this a bug or have I do something wrong ?
Thanks in advance for your help,
TSalm
    
    
More information about the Digitalmars-d-learn
mailing list