T
tomy
Hi All:
I just wonder what happened when i use operator "=" to construct an
obj, as following:
class Obj
{
public:
Obj();
Obj& operator = (const Obj &);
}
Obj a;
Obj b = a;
The Obj b will be constructed by "operator =" directly,
or first by "Obj()" , then turn to "operator =", two steps.
I've write some "cout" in both of the functions, with gcc, no print any
more;
But finally the Obj b contain the same value with Obj a, obviously;
So what happend?
Thanks
I just wonder what happened when i use operator "=" to construct an
obj, as following:
class Obj
{
public:
Obj();
Obj& operator = (const Obj &);
}
Obj a;
Obj b = a;
The Obj b will be constructed by "operator =" directly,
or first by "Obj()" , then turn to "operator =", two steps.
I've write some "cout" in both of the functions, with gcc, no print any
more;
But finally the Obj b contain the same value with Obj a, obviously;
So what happend?
Thanks