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

Computer Science & Information Technology

You might also like to view...

Match each term with the correct statement below.

A. Techniques aimed at ensuring the competency of the members of the organization B. Strategic methods for ensuring that the organization maintains a secure infrastructure C. Techniques aimed at ensuring the continuing functioning of the enterprise after an adverse event D. Techniques aimed at ensuring electronic data E. Techniques aimed at ensuring secure practice by the employees of the organization F. Techniques for ensuring that the operating environment of the machine and all of its associated applications remains secure G. Techniques aimed at evidence collection after an adverse event H. Techniques aimed at ensuring that the enterprise does not violate a regulation, standard, or law related to security I. Techniques aimed at ensuring continuous secure functioning of the enterprise

Computer Science & Information Technology

Answer the following statements true (T) or false (F)

1. You can use the view command to edit files just like the vi editor. 2. The more command is used to read files one screen at a time. 3. The paste command is used to append files. 4. The find command is used to find a field in a file. 5. The find command is used to locate specified files.

Computer Science & Information Technology

If your program recovers from an exception, you can use the ____ statement to repeat the execution of an entire begin/end code block

A. retry B. rescue C. end D. begin

Computer Science & Information Technology

The set of special instructions that are used to specify document structure, formatting, and links to other multimedia documents are called ________.

A. HTML B. hypertext C. multimedia D. web portal

Computer Science & Information Technology