Hi,

i do not understand where I am wrong in this code. I seems there is a missing constructor, but i have no idea where.


module main;


import std.stdio;


struct A_t
{
  int fvalue;


  A_t opCall()
  {
    return this;
  };

  @property  int value () { return fvalue; }

  @property void value (int avalue) { fvalue = avalue; }
}


struct B_t
{
  A_t  fext;


  int opCall() { return ext.value; };


  @property A_t  ext() { return fext; }

  @property void ext(A_t aext) { fext = aext; }
}



void main()
{
  B_t   test;


  test.ext.value = 9;
  int t = test();

  assert ( t == 9);   //  t  is always 0 instead of 9.


  readln();
}


cu
Guenter

Reply via email to