This code returns a reference to an object. It should compile, but something is wrong. What is wrong?
Foo& someFunction(int i)
{
Foo f;
f.doSomethingIncredible(i);
return f;
}
a. It returns a reference to a local variable that is destroyed (goes out of scope) when the function exits
b. Variable i should be passed by pointer
c. You cannot return a variable by reference
a. It returns a reference to a local variable that is destroyed (goes out of scope) when the function exits
You might also like to view...
Which of the following activities would most require the services of an HCT expert?
a. writing protocols for how computers exchange information b. writing computer drivers to allow the system unit and peripherals to interact c. designing an educational game d. designing an automated system for collecting results from a data probe
To prevent your network from being visible to others, disable the SSID broadcast
Indicate whether the statement is true or false