Victor Bazarov wrote:
2b|!2b==? wrote:
>>Is this legal ?
Seems acceptable. Why?
>>
MyClass& MyClass::Clone() const
{
//this should invoke the copy ctor ...
And it hopefully does.
> //but can I reference an object within itself ?
What do you mean by that? Why wouldn't you be able to?
After all, that's what the 'this' is for.
> MyClass* mc = new MyClass(*this);
return *mc ;
};
The trailing semicolon here is most likely illegal.
V
Erm, ill-posed question - sorry guys, I figured it out myself later. I
was getting myself confused about something entirely different - the
class I am using is a lot more "involved" than the trite MyClass I used
in the example - and I ended up getting myself confused. I think its
time I called it a day - been behind this screen for too long ...