|
-
May 1st, 2003, 08:07 AM
#1
what is the difference between reference and pointer
hi, buddy!I am a beginer here. thanks for your answer:
bow to everyone.
I am always confused by the reference and pointer. in the
code below I think it should return the Pointer 'this' but why
it return '*this', i think *this means the contents of the pointer.
who can help me? thanks a lot!
const Array &Array::operator =(const Array &right)
{
if(&right!=this)
{
delete [] ptr;
size = right.size;
ptr=new int[size];
assert(ptr!=0);
for(int i =0; i<size;i++)
ptr[i] = right.ptr[i];
}
return *this;
}
this function should return a const reference of Array,right?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|