On 2007-12-29 22:40:31 -0500,
said:
> #include <iostream>
> using namespace std;
>
> double & GetWeeklyHours()
> {
> double h = 46.50;
> double &hours = h;
> return hours;
> }
> //---------------------------------------------------------------------------
> int main()
> {
> double hours = GetWeeklyHours();
>
> cout << "Weekly Hours: " << hours << endl;
>
> return 0;
> }
>
>
> According to a (hopefully reliable) website, the above is correct
> code.
No. As far as I know, the standard makes no guarantee a behavior for
this code. This is no correct code.
BTW, please give the link to that website.
--
-kira