|
-
April 21st, 2003, 03:25 AM
#1
Question about local variable used as a reference.
Hi, everyone!
I have only noticed that reference variable are used as
parameter of a function before (or return value). For
example,
Source Code:
--------
function (const T& t)
--------
But today when reading the source code of some other's
today. I noticed that a local variable is declared as
reference type. Before I only noticed that lcoal variable
are used as pointer to origin type and origin type.
Source Code:
--------
T *pt;
T t;
--------
But now I noticed that a variable is declard like this in a
function,
Source Code:
--------
T t1;
T & t2 = t1;
--------
I want to know if a reference is used as a local variable, are there
any special things to notice? Or simply just the same as the reference
variable of a function parameter?
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
|