Why can't return an object instance by ref?

Sam Hu samhudotsamhu at gmail.com
Fri Jul 17 05:32:58 PDT 2009


Jarrett Billingsley Wrote:
> 
> Because 'new A' is not an lvalue.  Why do you want to return a
> reference to a class, anyway?  Classes already *are* by reference.

Thank you.I got it.
So how about q2:
but why this one also works?
ref createA(){return new A;} // no return type A?



More information about the Digitalmars-d-learn mailing list