Re: Problem of Pass by Reference in C++
From: lallous (lallous_at_lgwm.org)
Date: 12/15/03
- Next message: tom_usenet: "Re: The performance cost associated with std::vector."
- Previous message: lallous: "Re: how to declare a structure and a class interlinked"
- In reply to: alan: "Problem of Pass by Reference in C++"
- Next in thread: Jord: "Re: Problem of Pass by Reference in C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 15 Dec 2003 12:52:00 +0200
"alan" <cheung_yuklun@i-cable.com> wrote in message
news:7bd5ab13.0312150130.1759ee8e@posting.google.com...
> Hi All,
>
> I have a problem on C++ pass by reference concept.
>
> I saw some funcions which is :
>
> e.g.
> int& func(int &a)
> {
> ....
> ..
> }
>
> I understand the use of "int &a",
> but I would like to know what is the use of "int&" ? and how to use it?
> any examples?
>
> Please help.
> Best regards,
> Alan
Hello,
int t;
int &fnc()
{
return t;
}
This will return a reference to 't'
Usually the returning by reference is use in classes and to enable
cascading.
-- Elias
- Next message: tom_usenet: "Re: The performance cost associated with std::vector."
- Previous message: lallous: "Re: how to declare a structure and a class interlinked"
- In reply to: alan: "Problem of Pass by Reference in C++"
- Next in thread: Jord: "Re: Problem of Pass by Reference in C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|