On Thu, Jul 16, 2009 at 9:47 PM, Sam Hu<samhudotsa...@gmail.com> wrote:
> 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?

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

Reply via email to