|
-
April 17th, 2003, 09:52 AM
#1
Reference or pointer, which is better in my case?
Hi, everyone!
Sometimes we use pointer as the parameter type and sometimes
we use reference as the parameter type.
I think using reference is better than using object directly.
Since it can save memory and operation (assignment operator).
But what about pointer V.S. reference? I want to know in which
case should I use pointer and in which case should I use reference.
Here are two samples,
Using reference,
--------
ostream& operator << (ostream&, ObjectType);
--------
Using pointer
--------
MemPoolAddSize (char*, size_t)
--------
I want to know your suggestions about pointer v.s. reference.
What is the general consideration about when using pointer and
when using reference?
Thanks in advance,
George
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
|