Newsgroup: comp.lang.c++
Subject: A temporary created for the return reference from Assignement Operator?
From: pvinodhkumar@...
Date: Sat, 29 Jun 2013 04:08:00 -0700 (PDT)
class A
{
A();
A& operator = (const A& aObject_in);
int x;
int y;
};
A::A()
{
x = 0;
y = 0;
}
A& A::operator=(const A& aObject_in)
{
if(this != &aObject_in)
{
x = aObject_in.x;
y = aObject_in.y;
}
return *this; // A temporary created here?
}
int main()
{
A a1;
A a2;
a2 = a1;
}
Subject: A temporary created for the return reference from Assignement Operator?
From: pvinodhkumar@...
Date: Sat, 29 Jun 2013 04:08:00 -0700 (PDT)
class A
{
A();
A& operator = (const A& aObject_in);
int x;
int y;
};
A::A()
{
x = 0;
y = 0;
}
A& A::operator=(const A& aObject_in)
{
if(this != &aObject_in)
{
x = aObject_in.x;
y = aObject_in.y;
}
return *this; // A temporary created here?
}
int main()
{
A a1;
A a2;
a2 = a1;
}
via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?31507-A-temporary-created-for-the-return-reference-from-Assignement-Operator&goto=newpost
View all the progranning help forums at:
http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums
No comments:
Post a Comment