D - Return value from constructor
- Martin M. Pedersen (22/22) Jun 14 2002 Hi,
- Walter (4/26) Jun 14 2002 I'll have to think about that one!
- Sean L. Palmer (6/38) Jun 15 2002 Could be an interesting way to do a kind of "operator new".
Hi, It seems that constructors has a return type. The class Good below compiles, but Bad does not.: /* class Bad { this() { return; // causes "return value expected" } } */ class Good { this() { return this; // compiles fine } } It can't be right, can it? Regards, Martin M. Pedersen
Jun 14 2002
I'll have to think about that one! "Martin M. Pedersen" <mmp www.moeller-pedersen.dk> wrote in message news:aedpad$rma$1 digitaldaemon.com...Hi, It seems that constructors has a return type. The class Good belowcompiles,but Bad does not.: /* class Bad { this() { return; // causes "return value expected" } } */ class Good { this() { return this; // compiles fine } } It can't be right, can it? Regards, Martin M. Pedersen
Jun 14 2002
Could be an interesting way to do a kind of "operator new". I've toyed with that and so far nothing has turned up that looked good. But it has potential. Sean "Walter" <walter digitalmars.com> wrote in message news:aeelqn$1mk7$1 digitaldaemon.com...I'll have to think about that one! "Martin M. Pedersen" <mmp www.moeller-pedersen.dk> wrote in message news:aedpad$rma$1 digitaldaemon.com...Hi, It seems that constructors has a return type. The class Good belowcompiles,but Bad does not.: /* class Bad { this() { return; // causes "return value expected" } } */ class Good { this() { return this; // compiles fine } } It can't be right, can it? Regards, Martin M. Pedersen
Jun 15 2002