Why can't return an object instance by ref?
Sam Hu
samhudotsamhu at gmail.com
Thu Jul 16 18:47:30 PDT 2009
Hi,
With below code:
class A
{
}
class B
{
public:
ref A createA() // q2:without type name A is also OK?
{
return new A;//q1
}
}
My questions are:
q1.why this can't work?
q2.I can understand below code works:
A createA(){return new A;}
but why this one also works?
ref createA(){return new A;} // no return type A?
Thanks so much for your help in advance.
Regards,
Sam
More information about the Digitalmars-d-learn
mailing list