delegating constructors and "this = ..."
BCS
none at anon.com
Mon Feb 8 11:45:12 PST 2010
Hello JPF,
> Thanks for your help, I think I now understand what's going on.
> 'this' is a mutable local reference in the constructor but the
> constructor automatically returns the local 'this'. This explains why
> the first case works while the second doesn't. This would also mean I
> could do "this = this(ptr);" in the second constructor and it indeed
> does work; With the above change the whole testcase works as expected.
Odd....
> I now just have to decide whether I'll use the "implementation specific
> but nice syntax" way or a static function instead of public
> constructors.
don't use implementation specific code. I suggest you file a bug/clarification
request. If that is the way things are supposed to work, it should be officially
sanctioned. If not, it should be removed.
--
<IXOYE><
More information about the Digitalmars-d
mailing list