Why can't return an object instance by ref?
Jarrett Billingsley
jarrett.billingsley at gmail.com
Fri Jul 17 05:58:11 PDT 2009
On Fri, Jul 17, 2009 at 8:32 AM, Sam Hu<samhudotsamhu at gmail.com> wrote:
> 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?
>
>
I have no idea. Bug?
More information about the Digitalmars-d-learn
mailing list